/* ------------------------------------------------------------------ *
 *  Teamliste – Ausgabe im Frontend
 *
 *  Alle Farben kommen aus dem aktiven Design. Feste Werte stehen nur als
 *  letzter Rückfall dahinter (siehe docs/PLUGIN-API.md, Abschnitt 10).
 * ------------------------------------------------------------------ */

.tml {
    --tml-cols: 3;
    --tml-line: var(--rs-line, var(--line, rgba(128, 128, 128, .28)));
    --tml-soft: var(--rs-text-soft, var(--text-soft, rgba(128, 128, 128, .95)));
    --tml-face: var(--rs-surface, var(--surface, rgba(128, 128, 128, .06)));
    --tml-tint: var(--rs-surface-2, var(--surface-2, rgba(128, 128, 128, .12)));
    --tml-mark: var(--rs-accent, var(--accent, #2563eb));

    color: var(--rs-text, var(--text, inherit));
}

.tml * { box-sizing: border-box; }

/* ------------------------------------------------------------- Kopf */

.tml-head {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: flex-start;
    margin: 0 0 24px;
}

.tml-head-img {
    flex: 0 0 auto;
    max-width: 260px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--tml-line);
}

.tml-head-img img { display: block; width: 100%; height: auto; }

.tml-head-body { flex: 1 1 260px; min-width: 0; }

.tml-head-title { margin: 0 0 8px; font-size: 1.5em; line-height: 1.25; }

.tml-head-text p { margin: 0 0 10px; }
.tml-head-text p:last-child { margin-bottom: 0; }

.tml-count {
    margin: 10px 0 0;
    font-size: .88em;
    color: var(--tml-soft);
}

.tml-foot {
    margin: 26px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--tml-line);
    font-size: .95em;
}

.tml-foot p { margin: 0 0 10px; }
.tml-foot p:last-child { margin-bottom: 0; }

.tml-empty {
    margin: 0;
    padding: 18px 0;
    color: var(--tml-soft);
}

/* ----------------------------------------------------------- Gruppe */

.tml-group { margin: 0 0 30px; }
.tml-group:last-child { margin-bottom: 0; }

.tml-group-head {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--tml-mark);
}

.tml-group-img {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--tml-line);
    flex: 0 0 auto;
}

.tml-group-title {
    margin: 0;
    font-size: 1.15em;
    line-height: 1.3;
    color: var(--tml-mark);
}

.tml-group-text {
    margin-top: 3px;
    font-size: .9em;
    color: var(--tml-soft);
}

.tml-group-text p { margin: 0; }

/* ------------------------------------------------------------ Bild */

.tml-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--tml-tint);
    color: var(--tml-soft);
    font-weight: 700;
    line-height: 1;
}

.tml-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tml-avatar-sm {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 15px;
    border: 1px solid var(--tml-line);
}

.tml-avatar-lg {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 340px;
    border-radius: 0;
    font-size: 40px;
}

/* --------------------------------------------------------- Tabelle */

.tml-scroll { overflow-x: auto; }

.tml-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .95em;
}

.tml-table th,
.tml-table td {
    padding: 11px 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--tml-line);
}

.tml-table thead th {
    background: var(--tml-tint);
    font-size: .82em;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--tml-soft);
    white-space: nowrap;
    border-bottom: 1px solid var(--tml-line);
}

.tml-table tbody tr:last-child td { border-bottom: none; }

.tml-th-img { width: 70px; }
.tml-td-img { width: 70px; }
.tml-td-name { font-weight: 600; }
.tml-td-since { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tml-td-text { font-size: .94em; color: var(--tml-soft); }
.tml-td-text p { margin: 0 0 6px; }
.tml-td-text p:last-child { margin-bottom: 0; }

/* -------------------------------------------------------- Galerie */

.tml-cards {
    display: grid;
    grid-template-columns: repeat(var(--tml-cols), minmax(0, 1fr));
    gap: 18px;
}

.tml-card {
    border: 1px solid var(--tml-line);
    border-radius: 12px;
    overflow: hidden;
    background: var(--tml-face);
    display: flex;
    flex-direction: column;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.tml-card-img {
    position: relative;
    overflow: hidden;
    line-height: 0;
}

.tml-card-img .tml-avatar { transition: transform .35s ease, filter .35s ease; }

.tml-card-body { padding: 13px 15px 16px; }

.tml-card-name { margin: 0; font-size: 1.02em; line-height: 1.3; }

.tml-card-role {
    margin: 3px 0 0;
    font-size: .88em;
    font-weight: 600;
    color: var(--tml-mark);
}

.tml-card-since {
    margin: 4px 0 0;
    font-size: .82em;
    color: var(--tml-soft);
}

.tml-card-text {
    margin-top: 9px;
    font-size: .9em;
    color: var(--tml-soft);
}

.tml-card-text p { margin: 0 0 7px; }
.tml-card-text p:last-child { margin-bottom: 0; }

.tml-card-mail { margin: 10px 0 0; font-size: .88em; }
.tml-card-mail a { color: var(--rs-link, var(--rs-accent, var(--accent, #2563eb))); }

/* ---------------------------------------------------- Hover-Effekte */

.tml-fx-zoom .tml-card:hover .tml-avatar { transform: scale(1.07); }

.tml-fx-lift .tml-card:hover {
    transform: translateY(-5px);
    border-color: var(--tml-mark);
    box-shadow: 0 12px 26px rgba(0, 0, 0, .16);
}

.tml-fx-fade .tml-card .tml-avatar { filter: grayscale(1); }
.tml-fx-fade .tml-card:hover .tml-avatar { filter: grayscale(0); }

.tml-fx-slide .tml-card { position: relative; }

.tml-fx-slide .tml-card-body {
    transition: transform .3s ease;
}

.tml-fx-slide .tml-card:hover .tml-card-body {
    transform: translateY(-6px);
}

.tml-fx-slide .tml-card::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 3px;
    background: var(--tml-mark);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .3s ease;
}

.tml-fx-slide .tml-card:hover::after { transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
    .tml-card,
    .tml-card .tml-avatar,
    .tml-fx-slide .tml-card-body,
    .tml-fx-slide .tml-card::after { transition: none; }

    .tml-fx-zoom .tml-card:hover .tml-avatar,
    .tml-fx-lift .tml-card:hover,
    .tml-fx-slide .tml-card:hover .tml-card-body { transform: none; }
}

/* ------------------------------------------------------ schmal */

@media (max-width: 900px) {
    .tml-cards { grid-template-columns: repeat(min(var(--tml-cols), 2), minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .tml-cards { grid-template-columns: minmax(0, 1fr); }
    .tml-avatar-lg { aspect-ratio: 4 / 3; max-height: 250px; font-size: 32px; }
    .tml-head-img { max-width: 100%; }
    .tml-table th,
    .tml-table td { padding: 9px 8px; }
}

/* ------------------------------------------------------------- Box */

.tml-box { font-size: .95em; }

.tml-boxlist { list-style: none; margin: 0; padding: 0; }

.tml-boxitem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--tml-line);
}

.tml-boxitem:last-child { border-bottom: none; }

.tml-boxitem .tml-avatar-sm { width: 38px; height: 38px; font-size: 13px; flex: 0 0 auto; }

.tml-boxtext { min-width: 0; display: flex; flex-direction: column; }

.tml-boxname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tml-boxrole { font-size: .84em; color: var(--tml-soft); }
