/* Trackhistorie – helle Vorlage (Standard) und dunkle Variante */

.th {
    /* „Passend zum Design“ (Vorgabe): Farben aus dem aktiven Theme.
       Alle NovaCMS-Themes kennen --accent, --line, --surface-2 und --text. */
    --th-accent: var(--accent, #f97316);
    --th-bg: transparent;
    --th-card: rgba(128, 128, 128, .07);
    --th-line: var(--line, rgba(128, 128, 128, .28));
    --th-text: var(--text, currentColor);
    --th-soft: var(--text-soft, rgba(128, 128, 128, .95));
    --th-input: var(--surface-2, rgba(128, 128, 128, .12));
    --th-input-line: var(--line, rgba(128, 128, 128, .35));
    --th-btn: rgba(128, 128, 128, .2);
    --th-btn-text: var(--text, currentColor);
    --th-mint: color-mix(in srgb, var(--th-accent) 14%, transparent);
    --th-mint-line: color-mix(in srgb, var(--th-accent) 45%, transparent);
    --th-mint-text: var(--th-accent);
    --th-live-bg: color-mix(in srgb, var(--th-accent) 13%, transparent);
    --th-live-text: var(--th-accent);
    --th-live-badge: var(--th-accent);
    --th-cover: rgba(128, 128, 128, .18);
    --th-cover-icon: var(--text-soft, rgba(128, 128, 128, .9));
    --th-focus: var(--th-accent);
    background: var(--th-bg);
    color: var(--th-text);
    font-size: 15px;
    line-height: 1.4;
    border-radius: 10px;
    padding: 0 0 6px;
}

/* Hell – wie die Vorlage */
.th.th-hell {
    --th-accent: #1f9d55;
    --th-bg: #fafafa; --th-card: #ffffff; --th-line: #e0e0e0; --th-text: #3a3a3d; --th-soft: #6b7075;
    --th-input: #f1f6fb; --th-input-line: #b0c8e0; --th-btn: #cfd8dc; --th-btn-text: #212121;
    --th-mint: #dcf0eb; --th-mint-line: #acdfd2; --th-mint-text: #12866a;
    --th-live-bg: #dff0d8; --th-live-text: #3c763d; --th-live-badge: #1f9d55;
    --th-cover: #e0e0e0; --th-cover-icon: #71757a; --th-focus: #4a90d9;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Dunkel */
.th.th-dunkel {
    --th-accent: #34d399;
    --th-bg: #0f172a; --th-card: #111827; --th-line: #243041; --th-text: #e2e8f0; --th-soft: #9aa4b2;
    --th-input: #0b1120; --th-input-line: #334155; --th-btn: #1f2937; --th-btn-text: #e2e8f0;
    --th-mint: rgba(52, 211, 153, .12); --th-mint-line: rgba(52, 211, 153, .45); --th-mint-text: #34d399;
    --th-live-bg: rgba(34, 197, 94, .14); --th-live-text: #86efac; --th-live-badge: #16a34a;
    --th-cover: #1f2937; --th-cover-icon: #64748b; --th-focus: #34d399;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
.th.th-design { padding-bottom: 0; }

.th *, .th *::before, .th *::after { box-sizing: border-box; }
.th-i { flex: 0 0 auto; display: block; }

/* ---------------------------------------------------------------- Filter */
.th .th-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 18px;
    align-items: flex-end;
    background: var(--th-card);
    border: 1px solid var(--th-line);
    border-radius: 10px;
    padding: 16px 18px 12px;
    margin: 0 0 24px;
}
.th.th-hell .th-filter { border-radius: 6px; }

.th .th-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; }
.th .th-label { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--th-soft); }
.th-day { flex: 0 0 auto; }
.th-hour { flex: 0 1 170px; min-width: 160px; }
.th-search { flex: 1 1 200px; min-width: 180px; }
.th-dayrow { display: flex; gap: 6px; align-items: center; }

/* Eingabefelder: feste Höhe – Themes mit großem Innenabstand schneiden sonst Text ab */
.th .th-filter .th-input {
    box-sizing: border-box !important;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 0 12px !important;
    line-height: 38px !important;
    font: inherit !important;
    font-size: 15px !important;
    color: var(--th-text) !important;
    background-color: var(--th-input) !important;
    border: 1px solid var(--th-input-line) !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    width: 100%;
    min-width: 0;
}
.th .th-filter select.th-input { padding-right: 34px !important; line-height: normal !important; cursor: pointer; }
.th .th-filter .th-date { width: 152px; line-height: normal !important; padding: 0 10px !important; }
.th .th-filter .th-input::placeholder { color: var(--th-soft); opacity: 1; }
.th .th-filter .th-input:focus { outline: 2px solid var(--th-focus) !important; outline-offset: 0; border-color: transparent !important; }
.th.th-dunkel .th-input, .th.th-design .th-input { color-scheme: dark light; }
.th.th-hell .th-input { color-scheme: light; }

.th .th-btn {
    display: inline-grid; place-items: center; box-sizing: border-box;
    height: 40px; width: 40px; padding: 0; margin: 0;
    border: 1px solid transparent; border-radius: 8px;
    background: var(--th-btn); color: var(--th-btn-text);
    font: inherit; font-size: 14px; line-height: 1; cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.th .th-btn:hover:not(:disabled) { background: var(--th-accent); color: #fff; }
.th.th-hell .th-btn:hover:not(:disabled) { background: #b9c5ca; color: #212121; }
.th .th-btn:disabled { opacity: .35; cursor: default; }
.th .th-btn:focus-visible { outline: 2px solid var(--th-focus); outline-offset: 1px; }

.th .th-note {
    flex: 1 0 100%; display: flex; align-items: center; gap: 6px;
    margin: 2px 0 0; font-size: 12px; color: var(--th-soft);
}

/* --------------------------------------------------------- Stundenblöcke */
.th-hourblock + .th-hourblock { margin-top: 30px; }

.th .th-hour-head {
    display: flex; align-items: center; gap: 8px;
    margin: 0; padding: 0 2px 12px; border-bottom: 1px solid var(--th-line);
    font-size: 22px; font-weight: 600; color: var(--th-text); line-height: 1.2;
}
.th-hour-head .th-i { width: 18px; height: 18px; }
.th-hour-count {
    font-size: 12px; font-weight: 600; color: var(--th-mint-text);
    background: var(--th-mint); border: 1px solid var(--th-mint-line);
    border-radius: 999px; padding: 1px 8px; line-height: 1.5;
}

.th .th-rows { list-style: none; margin: 0; padding: 0; }

.th .th-row {
    display: grid; grid-template-columns: 56px 64px 1fr auto; gap: 14px; align-items: center;
    margin: 0; padding: 10px 10px; border-bottom: 1px solid var(--th-line);
}
.th .th-row.is-live { background: var(--th-live-bg); border-radius: 8px; border-bottom-color: transparent; margin: 8px 0 0;
    box-shadow: inset 3px 0 0 var(--th-live-badge); }
.th.th-hell .th-row.is-live { box-shadow: none; border-radius: 4px; }

.th-time { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; color: var(--th-text); padding-left: 0; }

.th-cover {
    width: 64px; height: 64px; border-radius: 6px; overflow: hidden; display: grid; place-items: center;
    background: var(--th-cover); color: var(--th-cover-icon);
}
.th-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.th-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.th-title { font-weight: 700; font-size: 15px; color: var(--th-text); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; overflow-wrap: anywhere; }
.th-artist { color: var(--th-text); opacity: .9; overflow-wrap: anywhere; }
.th-row.is-live .th-title, .th-row.is-live .th-artist { color: var(--th-live-text); }

.th-live {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--th-live-badge); color: #fff; letter-spacing: .01em; font-size: 12px; font-weight: 700;
    padding: 3px 10px; border-radius: 999px; line-height: 1.3;
}
.th-live i { width: 6px; height: 6px; border-radius: 50%; background: #c7f5d9; display: block; animation: th-blink 1.6s ease-in-out infinite; }
@keyframes th-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .th-live i { animation: none; } }

.th-actions { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }

.th-count {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 700; color: var(--th-mint-text);
    background: var(--th-mint); border: 1px solid var(--th-mint-line);
    border-radius: 999px; padding: 3px 12px; font-variant-numeric: tabular-nums; white-space: nowrap;
}

.th .th-ytbtn, .th a.th-ytbtn:link, .th a.th-ytbtn:visited {
    display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
    background: var(--th-btn); color: var(--th-btn-text); border-radius: 6px; font-weight: 600;
    font-size: 13px; text-decoration: none; white-space: nowrap;
}
.th a.th-ytbtn:hover { filter: brightness(1.12); color: var(--th-btn-text); }

.th-empty { display: flex; align-items: center; gap: 10px; color: var(--th-soft); padding: 20px 4px; margin: 0; }

.th.is-loading .th-list { opacity: .55; transition: opacity .15s; }

/* ----------------------------------------------------------------- Handy */
@media (max-width: 600px) {
    .th .th-filter { padding: 14px; }
    .th-day, .th-hour, .th-search { flex: 1 0 100%; }
    .th .th-filter .th-date { flex: 1; width: auto; }
    .th .th-cal { display: none; }
    .th .th-hour-head { font-size: 18px; }
    .th .th-row { grid-template-columns: 44px 52px 1fr; gap: 10px; padding: 10px 6px; }
    .th-cover { width: 52px; height: 52px; }
    .th-time { font-size: 13px; }
    .th-actions { grid-column: 3; justify-content: flex-start; }
    .th .th-ytbtn span { display: none; }
}
