/* ============================================================
   Anwesenheitsübersicht einer Wahlperiode
   (templates/anwesenheit_uebersicht.html, Daten: anwesenheit_tabelle.py)
   ============================================================ */

/* Die Tabelle braucht mehr Breite als die übrigen Sitzungsseiten */
.sitzung-seite.anwesenheit-seite {
    width: min(1500px, calc(100% - 32px));
}

.anwesenheit-wp-auswahl {
    display: flex;
    align-items: center;
    gap: 8px;
}

.anwesenheit-wp-auswahl select {
    min-height: 36px;
    padding: 4px 10px;

    border: 1px solid var(--farbe-rahmen);
    border-radius: var(--radius-button);

    background: var(--farbe-oberflaeche);
    color: var(--farbe-text);

    font: inherit;
}


/* ---------- Statuslegende ---------- */

.anw-legende-zeile {
    margin-bottom: 12px;

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 24px;
}

/* Umschalter „Ausgeschiedene Mitglieder anzeigen“ */
.anw-schalter {
    display: inline-flex;
    align-items: center;
    gap: 10px;

    font-size: 15px;
    color: var(--farbe-text);
    text-decoration: none;
}

.anw-schalter:hover {
    color: var(--farbe-text);
}

.anw-schalter-bahn {
    position: relative;
    flex: 0 0 40px;
    width: 40px;
    height: 22px;

    background-color: var(--farbe-rahmen-stark);
    border-radius: 11px;
    transition: background-color 0.15s;
}

.anw-schalter-bahn span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;

    background-color: var(--weiss);
    border-radius: 50%;
    transition: left 0.15s;
}

.anw-schalter[aria-checked="true"] .anw-schalter-bahn {
    background-color: var(--farbe-primaer);
}

.anw-schalter[aria-checked="true"] .anw-schalter-bahn span {
    left: 21px;
}

.anw-schalter:focus-visible {
    outline: 2px solid var(--farbe-primaer);
    outline-offset: 3px;
    border-radius: var(--radius-normal);
}

.anw-legende-status {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;

    color: var(--farbe-text-sekundaer);
    font-size: 0.84rem;
}

.anw-legende-eintrag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.anw-legende-eintrag .anw-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 1.6rem;
    height: 1.35rem;

    border-radius: 4px;
}


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

.anw-rahmen {
    overflow-x: auto;

    border: 1px solid var(--farbe-rahmen);
    border-radius: var(--radius-normal);

    background-color: var(--farbe-oberflaeche);
}

.anw-tabelle {
    width: 100%;

    border-collapse: separate;
    border-spacing: 0;

    font-size: 0.85rem;
}

.anw-tabelle th,
.anw-tabelle td {
    padding: 5px 8px;

    border-bottom: 1px solid var(--farbe-rahmen);

    white-space: nowrap;
}

.anw-tabelle thead th {
    position: sticky;
    top: 0;
    z-index: 2;

    padding-top: 10px;
    padding-bottom: 10px;

    border-bottom: 2px solid var(--farbe-rahmen-stark);

    background: var(--farbe-oberflaeche-dezent);
    color: var(--farbe-text-sekundaer);

    font-size: 0.75rem;
    font-weight: 700;
    text-align: left;
}

.anw-tabelle thead .anw-sitzung,
.anw-tabelle thead .anw-summe {
    text-align: center;
}

.anw-sitzung a {
    display: flex;
    flex-direction: column;
    align-items: center;

    color: inherit;
    text-decoration: none;
}

.anw-sitzung a:hover {
    color: var(--farbe-primaer);
}

.anw-sitzung small {
    color: var(--farbe-text-dezent);
    font-weight: 500;
}

/* Fraktionen optisch trennen */
.anw-fraktion tr:last-child > * {
    border-bottom: 2px solid var(--farbe-rahmen-stark);
}

.anw-fraktion tr:nth-child(even) > td:not(.anw-status),
.anw-fraktion tr:nth-child(even) > th.anw-fix-name {
    background-color: var(--farbe-oberflaeche-hover);
}


/* ---------- Feste linke Spalten (beim waagerechten Scrollen) ---------- */

.anw-fix {
    position: sticky;
    z-index: 1;

    background-color: var(--farbe-oberflaeche);
}

.anw-tabelle thead .anw-fix {
    z-index: 3;
}

.anw-fix-fraktion {
    left: 0;

    width: 5.5rem;
    min-width: 5.5rem;
    max-width: 5.5rem;
}

.anw-fix-nr {
    left: 5.5rem;

    width: 2.4rem;
    min-width: 2.4rem;

    color: var(--farbe-text-dezent);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.anw-fix-name {
    left: 7.9rem;

    min-width: 12rem;

    border-right: 1px solid var(--farbe-rahmen-stark);

    font-weight: 500;
    text-align: left;
}

.anw-fix-name a {
    color: var(--farbe-text);
    text-decoration: none;
}

.anw-fix-name a:hover {
    color: var(--farbe-primaer);
    text-decoration: underline;
}

.anw-fraktionsblock {
    vertical-align: middle;

    border-bottom-color: rgba(255, 255, 255, 0.35) !important;

    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    hyphens: manual;
}

.anw-fraktionsblock a {
    text-decoration: none;
}


/* ---------- Zusatzinfos ---------- */

.anw-info {
    color: var(--farbe-text-sekundaer);
    font-size: 0.8rem;
}

.anw-info abbr {
    text-decoration: none;
    cursor: help;
}


/* ---------- Statuszellen ---------- */

.anw-status {
    min-width: 4.4rem;

    border-left: 1px solid var(--farbe-oberflaeche);

    font-weight: 700;
    text-align: center;
}

.anw-gruen { background-color: rgba(46, 160, 67, 0.20); color: #1a7f37; }
.anw-gelb  { background-color: rgba(212, 167, 44, 0.28); color: #8a6a00; }
.anw-rot   { background-color: rgba(207, 34, 46, 0.18); color: #b3261e; }
.anw-grau  { background-color: rgba(110, 119, 129, 0.22); color: #57606a; }
.anw-leer  { background-color: var(--farbe-oberflaeche-dezent); }

:root[data-theme="dark"] .anw-gruen,
:root[data-theme="dark"] .anw-text-gruen { color: #56d364; }
:root[data-theme="dark"] .anw-gelb,
:root[data-theme="dark"] .anw-text-gelb  { color: #e3b341; }
:root[data-theme="dark"] .anw-rot,
:root[data-theme="dark"] .anw-text-rot   { color: #ff7b72; }


.anw-vakant .anw-fix-name {
    color: var(--farbe-text-dezent);
}

.anw-vakant-sitzungen {
    background: repeating-linear-gradient(
        -45deg,
        var(--farbe-oberflaeche-dezent),
        var(--farbe-oberflaeche-dezent) 6px,
        transparent 6px,
        transparent 12px
    );
}

.anw-summe {
    color: var(--farbe-text);
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.anw-summe-von {
    color: var(--farbe-text-dezent);
    font-weight: 500;
}


/* ---------- Summen je Sitzung ---------- */

.anw-tabelle tfoot th,
.anw-tabelle tfoot td {
    background-color: var(--farbe-oberflaeche-dezent);
}

.anw-tabelle tfoot tr:first-child > * {
    border-top: 2px solid var(--farbe-rahmen-stark);
}

.anw-fix-fuss {
    left: 0;

    background-color: var(--farbe-oberflaeche-dezent) !important;
    color: var(--farbe-text-sekundaer);

    font-size: 0.8rem;
    text-align: right;
}

.anw-fuss-zahl {
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.anw-text-gruen { color: #1a7f37; }
.anw-text-gelb  { color: #8a6a00; }
.anw-text-rot   { color: #b3261e; }
.anw-text-grau  { color: var(--farbe-text-sekundaer); }


/* ---------- Abkürzungslegende ---------- */

.anw-legende {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px 32px;

    margin-top: 20px;
    padding: 16px 20px;

    border: 1px solid var(--farbe-rahmen);
    border-radius: var(--radius-normal);

    background-color: var(--farbe-oberflaeche);
}

.anw-legende h3 {
    margin: 0 0 8px;

    color: var(--farbe-text);
    font-size: 0.9rem;
}

.anw-legende dl {
    display: grid;
    gap: 4px;

    margin: 0;

    font-size: 0.82rem;
}

.anw-legende dl div {
    display: flex;
    gap: 10px;
}

.anw-legende dt {
    min-width: 3.5rem;

    color: var(--farbe-text);
    font-weight: 700;
}

.anw-legende dd {
    margin: 0;

    color: var(--farbe-text-sekundaer);
}


@media (max-width: 700px) {
    /* Auf dem Handy nur Name fixieren, Fraktionsspalte schmaler */
    .anw-fix-fraktion { width: 3.4rem; min-width: 3.4rem; max-width: 3.4rem; font-size: 0.7rem; }
    .anw-fix-nr { left: 3.4rem; }
    .anw-fix-name { left: 5.8rem; min-width: 9rem; }
}


/* Markierung bei Fraktionswechsel innerhalb der Wahlperiode */
.anw-wechsel {
    margin-left: 4px;

    color: var(--farbe-text-dezent);
    font-size: 0.8rem;
    cursor: help;
}


/* Nicht mehr Mitglied (nach dem Ausscheiden) - gleiche Farbe wie "nicht erfasst" */
.anw-ausgeschieden {
    background-color: var(--farbe-oberflaeche-dezent);
}

.anw-zeile-ausgeschieden .anw-fix-name a {
    color: var(--farbe-text-sekundaer);
}


.anwesenheit-kopf-aktionen {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
}
