/* ==========================================================================
   Einsatzplanung Turnierleitung
   Slot-Höhe ist fest 20px und muss zu TTEinsatzplanung::pixel() passen.
   ========================================================================== */

.tl-wrap {
    --tl-slot: 20px;
    --tl-rand: #d7dce1;
    --tl-flaeche: #fff;
    --tl-kopf: #f1f3f5;
    --tl-text: #23282d;
    --tl-gedaempft: #6b7580;
}

.tl-plan-kopf {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin: 12px 0 18px;
    padding: 10px 14px;
    background: var(--tl-kopf);
    border: 1px solid var(--tl-rand);
    border-radius: 5px;
}

.tl-plan-kopf form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.tl-plan-info {
    color: var(--tl-gedaempft);
    font-size: 13px;
}

.tl-hilfe {
    color: var(--tl-gedaempft);
    font-size: 13px;
    max-width: 70ch;
}

/* --- Zweispaltiges Layout ------------------------------------------------ */

.tl-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.tl-hauptbereich {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
}

.tl-seitenleiste {
    flex: 0 0 260px;
    position: sticky;
    top: 40px;
    background: var(--tl-flaeche);
    border: 1px solid var(--tl-rand);
    border-radius: 5px;
    padding: 14px;
}

.tl-zweispaltig {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 28px;
    align-items: start;
}

/* --- Raster --------------------------------------------------------------- */

.tl-tag {
    margin-bottom: 34px;
}

.tl-tag-titel {
    margin: 0 0 6px;
    font-size: 16px;
}

.tl-konkurrenz-leiste {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--tl-gedaempft);
}

.tl-konkurrenz strong {
    color: var(--tl-text);
}

.tl-raster {
    display: flex;
    border: 1px solid var(--tl-rand);
    border-radius: 5px;
    background: var(--tl-flaeche);
    overflow: hidden;
    width: max-content;
    min-width: 100%;
}

.tl-zeitachse {
    flex: 0 0 58px;
    border-right: 1px solid var(--tl-rand);
    background: var(--tl-kopf);
}

.tl-spalte {
    flex: 1 1 150px;
    min-width: 150px;
    border-right: 1px solid var(--tl-rand);
}

.tl-spalte:last-child {
    border-right: none;
}

.tl-kopf {
    height: 34px;
    line-height: 34px;
    padding: 0 8px;
    font-weight: 600;
    font-size: 13px;
    background: var(--tl-kopf);
    border-bottom: 1px solid var(--tl-rand);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tl-soll {
    color: var(--tl-gedaempft);
    font-weight: 400;
}

/* box-sizing muss hier explizit stehen: die 1px-Trennlinien dürfen die
   Slot-Höhe nicht vergrößern, sonst laufen Zeitachse und die absolut
   positionierten Schichtkacheln auseinander. */
.tl-zeit {
    box-sizing: border-box;
    height: var(--tl-slot);
    font-size: 11px;
    line-height: calc(var(--tl-slot) - 1px);
    text-align: right;
    padding-right: 6px;
    color: var(--tl-gedaempft);
    border-bottom: 1px solid transparent;
}

.tl-zeit.tl-volle-stunde {
    color: var(--tl-text);
    border-bottom-color: var(--tl-rand);
}

.tl-flaeche {
    position: relative;
}

.tl-slot {
    box-sizing: border-box;
    height: var(--tl-slot);
    border-bottom: 1px solid #eef1f4;
    cursor: cell;
}

.tl-slot.tl-volle-stunde {
    border-bottom-color: var(--tl-rand);
}

.tl-slot.tl-auswahl {
    background: rgba(0, 115, 170, 0.18);
}

.tl-nur-lesen .tl-slot {
    cursor: default;
}

/* Unbesetzte Pflichtzeiten */
.tl-luecke {
    position: absolute;
    left: 0;
    right: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        135deg,
        rgba(198, 40, 40, 0.13),
        rgba(198, 40, 40, 0.13) 5px,
        transparent 5px,
        transparent 10px
    );
    border-left: 3px solid rgba(198, 40, 40, 0.55);
}

/* Sperrzeiten der ausgewählten Person */
.tl-sperre {
    position: absolute;
    left: 0;
    right: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        45deg,
        rgba(70, 70, 70, 0.16),
        rgba(70, 70, 70, 0.16) 4px,
        transparent 4px,
        transparent 8px
    );
}

.tl-sperre.tl-sperre-ungern {
    background: repeating-linear-gradient(
        45deg,
        rgba(239, 108, 0, 0.14),
        rgba(239, 108, 0, 0.14) 4px,
        transparent 4px,
        transparent 8px
    );
}

/* Schichtkacheln */
.tl-schicht {
    position: absolute;
    box-sizing: border-box;
    padding: 2px 5px;
    border-radius: 3px;
    color: #fff;
    font-size: 11px;
    line-height: 1.25;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.18);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.tl-nur-lesen .tl-schicht {
    cursor: default;
}

.tl-schicht-zeit {
    display: block;
    opacity: 0.85;
    font-size: 10px;
}

.tl-schicht-namen {
    display: block;
    font-weight: 600;
}

.tl-schicht-notiz {
    display: block;
    font-style: italic;
    opacity: 0.9;
}

.tl-schicht.tl-konflikt {
    border: 2px solid #c62828;
    box-shadow: 0 0 0 1px #fff inset;
}

.tl-schicht.tl-offen {
    background-image: repeating-linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.22),
        rgba(255, 255, 255, 0.22) 5px,
        transparent 5px,
        transparent 10px
    );
}

.tl-schicht.tl-hervorgehoben {
    outline: 3px solid #ffb900;
    outline-offset: -1px;
    z-index: 3;
}

.tl-schicht.tl-abgeblendet {
    opacity: 0.3;
}

/* --- Personenliste -------------------------------------------------------- */

.tl-personenliste {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tl-personenliste li {
    padding: 7px 9px;
    margin-bottom: 4px;
    border: 1px solid var(--tl-rand);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.tl-personenliste li:hover {
    background: var(--tl-kopf);
}

.tl-personenliste li.tl-aktiv {
    background: #e6f1f7;
    border-color: #0073aa;
}

.tl-person-name {
    display: block;
    font-weight: 600;
}

.tl-person-bemerkung {
    display: block;
    color: var(--tl-gedaempft);
    font-size: 11px;
    margin-top: 2px;
}

/* --- Karten in Verwaltungsseiten ------------------------------------------ */

.tl-person-karte {
    border: 1px solid var(--tl-rand);
    border-radius: 5px;
    padding: 12px 14px;
    margin-bottom: 12px;
    background: var(--tl-flaeche);
}

.tl-person-kopf {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tl-person-kopf .tl-aktionen {
    margin-left: auto;
    font-size: 12px;
}

.tl-farbpunkt {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.tl-zeitliste {
    margin: 8px 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
}

.tl-zeitliste li {
    padding: 3px 0;
    border-bottom: 1px dotted #e3e6ea;
}

.tl-zeitliste em {
    color: var(--tl-gedaempft);
}

.tl-entfernen {
    color: #c62828;
    text-decoration: none;
    font-weight: 700;
    margin-left: 6px;
}

.tl-inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.tl-inline-form input[type="text"] {
    flex: 1 1 140px;
    min-width: 120px;
}

.tl-tag-label {
    display: inline-block;
    min-width: 78px;
    font-size: 12px;
    color: var(--tl-gedaempft);
}

.tl-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 600;
}

.tl-badge-gesperrt,
.tl-badge-doppelbelegung {
    background: #fdecea;
    color: #c62828;
}

.tl-badge-ungern {
    background: #fff4e5;
    color: #ef6c00;
}

.tl-offen-zellen {
    color: #c62828;
    font-weight: 600;
}

.tl-token {
    display: inline-block;
    padding: 6px 10px;
    background: var(--tl-kopf);
    border: 1px solid var(--tl-rand);
    border-radius: 4px;
    word-break: break-all;
}

/* --- Dialog --------------------------------------------------------------- */

.tl-dialog {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.tl-dialog-box {
    background: #fff;
    border-radius: 6px;
    padding: 22px 24px;
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.tl-dialog-box h2 {
    margin-top: 0;
}

.tl-dialog-zeile {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.tl-dialog-zeile > label {
    flex: 0 0 70px;
    padding-top: 5px;
    font-weight: 600;
}

.tl-dialog-zeile input[type="text"] {
    flex: 1 1 260px;
}

.tl-personen-auswahl {
    flex: 1 1 300px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 4px;
    max-height: 190px;
    overflow-y: auto;
    border: 1px solid var(--tl-rand);
    border-radius: 4px;
    padding: 8px;
}

.tl-person-check {
    font-size: 13px;
    white-space: nowrap;
}

.tl-konflikt-box {
    border-left: 4px solid #c62828;
    background: #fdecea;
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: 13px;
}

.tl-konflikt-box ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

.tl-dialog-aktionen {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tl-dialog-aktionen .tl-loeschen {
    margin-left: auto;
    color: #c62828;
}

/* --- Öffentliche Ansicht -------------------------------------------------- */

.tl-oeffentlich .tl-raster {
    max-width: 100%;
    overflow-x: auto;
}

.tl-dienstplaene {
    margin-top: 26px;
}

.tl-dienstplan {
    display: inline-block;
    vertical-align: top;
    min-width: 220px;
    margin: 0 18px 16px 0;
    font-size: 13px;
}

.tl-dienstplan ul {
    margin: 4px 0 0;
    padding-left: 18px;
}

.tl-leer {
    color: var(--tl-gedaempft);
    font-style: italic;
    margin: 4px 0 0;
}

/* --- Druck ---------------------------------------------------------------- */

@media print {
    .tl-nicht-drucken,
    #adminmenumain,
    #wpadminbar,
    #wpfooter,
    .notice {
        display: none !important;
    }

    #wpcontent,
    #wpbody-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .tl-druckbereich {
        width: 100%;
    }

    .tl-tag {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .tl-schicht {
        color: #000 !important;
        background: #fff !important;
        border: 1px solid #333 !important;
        box-shadow: none !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .tl-dienstplaene {
        page-break-before: always;
    }

    @page {
        size: A4 landscape;
        margin: 10mm;
    }
}

/* --- Schmale Bildschirme -------------------------------------------------- */

@media (max-width: 1100px) {
    .tl-layout {
        flex-direction: column;
    }

    .tl-seitenleiste {
        position: static;
        flex: 1 1 auto;
        width: 100%;
    }
}
