/* ==========================================================
   SATzentrale RadioDX – Stylesheet
   Heller, moderner Look auf weißem Hintergrund
   ========================================================== */

:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f6f8fb;
    --border: #e4e9f0;
    --border-strong: #d3dbe5;

    --text: #0f1b2a;
    --text-2: #3b4a5c;
    --muted: #6b7a8c;

    --green: #12b76a;
    --green-dark: #067647;
    --green-soft: #e9f9f1;

    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --blue-soft: #eaf1ff;

    --amber: #f79009;
    --amber-dark: #b54708;
    --amber-soft: #fff4dc;

    --red: #e5383b;
    --red-dark: #b42318;
    --red-soft: #fdecec;

    --radius: 16px;
    --shadow-sm: 0 1px 2px rgba(16, 32, 52, 0.05), 0 2px 8px rgba(16, 32, 52, 0.05);
    --shadow-md: 0 12px 32px rgba(16, 32, 52, 0.12);

    --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
}


/* ==========================================================
   RESET / BASIS
   ========================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.45;
}

:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.45);
    outline-offset: 2px;
}

.radiodx-wrapper {
    width: min(1450px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 40px;
}


/* ==========================================================
   HEADER
   ========================================================== */

.radiodx-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px 24px;
    padding-bottom: 18px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    padding: 7px;
    border-radius: 15px;
    background: var(--green-soft);
    color: var(--green);
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
}

.logo-icon circle {
    fill: currentColor;
    stroke: none;
}

.logo-icon .wave {
    opacity: 0.2;
    animation: wave 2.4s ease-in-out infinite;
}

.logo-icon .w2 { animation-delay: 0.25s; }
.logo-icon .w3 { animation-delay: 0.5s; }

.logo-title {
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.1;
}

.logo-title span {
    color: var(--green);
}

.radiodx-subtitle {
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
}

.clocks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.clock {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 138px;
    padding: 9px 15px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.clock-label {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.clock time {
    font-family: var(--mono);
    font-size: 21px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.clock-utc {
    border-color: #c6d9ff;
    background: var(--blue-soft);
}

.clock-utc .clock-label {
    color: var(--blue);
}


/* ==========================================================
   AKTUALISIERUNGS-BALKEN
   ========================================================== */

.refresh {
    height: 3px;
    margin-bottom: 18px;
    overflow: hidden;
    border-radius: 3px;
    background: var(--border);
}

.refresh span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green), #4fe3a4);
}

@keyframes refreshBar {
    from { width: 0; }
    to   { width: 100%; }
}

.offline-banner {
    display: none;
    margin-bottom: 14px;
    padding: 10px 14px;
    border: 1px solid #f6c667;
    border-radius: 10px;
    background: var(--amber-soft);
    color: var(--amber-dark);
    font-size: 13px;
}

body.offline .offline-banner {
    display: block;
}


/* ==========================================================
   FILTER
   ========================================================== */

.filters {
    margin-bottom: 20px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.search {
    position: relative;
    flex: 1 1 260px;
}

.search svg {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    color: var(--muted);
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    pointer-events: none;
}

.search input,
.sort select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search input {
    padding-left: 36px;
}

.search input:focus,
.sort select:focus {
    border-color: var(--green);
    outline: none;
    box-shadow: 0 0 0 4px rgba(18, 183, 106, 0.15);
}

.sort {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.sort select {
    width: auto;
    cursor: pointer;
}

.reset {
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    background: #fff;
    color: var(--text-2);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    transition: all 0.15s ease;
}

.reset:hover {
    border-color: var(--red);
    background: var(--red-soft);
    color: var(--red-dark);
}

.filter-group {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 10px;
    align-items: start;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.filter-label {
    padding-top: 8px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 8px 7px 13px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: #fff;
    color: var(--text-2);
    cursor: pointer;
    font: inherit;
    font-size: 12.5px;
    font-weight: 650;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.chip:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: var(--green);
    color: var(--green-dark);
}

.chip:active:not(:disabled) {
    transform: scale(0.97);
}

.chip-dot {
    width: 8px;
    height: 8px;
    margin-left: -3px;
    border-radius: 50%;
    background: var(--accent, var(--muted));
}

.chip-count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    text-align: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.chip[aria-pressed="true"] {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green-dark);
    box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.14);
}

.chip[aria-pressed="true"] .chip-count {
    background: var(--green);
    color: #fff;
}

.chip:disabled {
    cursor: default;
    opacity: 0.4;
}


/* ==========================================================
   STATUSLEISTE
   ========================================================== */

.stat-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    margin-bottom: 16px;
}

.stat {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 9px 15px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--muted);
    font-size: 12.5px;
}

.stat strong {
    color: var(--text);
    font-size: 21px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.stat-live strong {
    color: var(--red-dark);
}

.stat-dot {
    align-self: center;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--red);
    --pulse: 229, 56, 59;
    animation: pulse 1.6s infinite;
}

.stat-meta {
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
}

.notice {
    margin-bottom: 14px;
    padding: 10px 14px;
    border: 1px solid #f6c667;
    border-radius: 10px;
    background: var(--amber-soft);
    color: var(--amber-dark);
    font-size: 13px;
}


/* ==========================================================
   SENDER-RASTER
   ========================================================== */

.station-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 16px;
}

.station-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 18px 16px 23px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.4s ease, filter 0.4s ease;
}

/* farbiger Streifen je Zielgebiet */
.station-card::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 5px;
    background: var(--accent, var(--border-strong));
}

.station-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

.filtered-out {
    display: none;
}

.station-card.reveal {
    animation: reveal 0.3s ease both;
}

/* Einblend-Animation beim ersten Laden */
.intro .station-card {
    animation: cardIn 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    animation-delay: calc(var(--i, 0) * 30ms);
}

/* Zustände */
.station-card[data-state="soon"] {
    border-style: dashed;
    border-color: #bcd0f7;
}

.station-card[data-state="ended"] {
    opacity: 0.5;
    filter: grayscale(0.7);
}


/* ----- Kopfzeile: Badge + Band ----- */

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.badge {
    --pulse: 229, 56, 59;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 11px 4px 9px;
    border-radius: 999px;
    background: var(--red-soft);
    color: var(--red-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.07em;
    transition: background 0.3s ease, color 0.3s ease;
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red);
    animation: pulse 1.6s infinite;
}

[data-state="ending"] .badge {
    --pulse: 247, 144, 9;
    background: var(--amber-soft);
    color: var(--amber-dark);
}

[data-state="ending"] .badge-dot {
    background: var(--amber);
    animation-duration: 1s;
}

[data-state="soon"] .badge {
    --pulse: 37, 99, 235;
    background: var(--blue-soft);
    color: var(--blue-dark);
}

[data-state="soon"] .badge-dot {
    background: var(--blue);
    animation: blink 1.8s ease-in-out infinite;
}

[data-state="ended"] .badge {
    background: #eef1f5;
    color: var(--muted);
}

[data-state="ended"] .badge-dot {
    background: #9aa7b5;
    animation: none;
}

.band-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text-2);
    font-family: var(--mono);
    font-size: 11.5px;
    font-weight: 700;
}

.band-pill i {
    padding-left: 7px;
    border-left: 1px solid var(--border-strong);
    color: var(--muted);
    font-style: normal;
    font-weight: 600;
}


/* ----- Frequenz & Name ----- */

.frequency {
    display: flex;
    align-items: baseline;
    gap: 6px;
    color: var(--text);
    font-size: 37px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.04em;
    line-height: 1;
}

.frequency span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
}

[data-state="soon"] .frequency {
    color: var(--text-2);
}

.station-name {
    margin: -4px 0 0;
    color: var(--text);
    font-size: 18px;
    font-weight: 750;
    line-height: 1.3;
}


/* ----- Metadaten ----- */

.meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.meta div {
    min-width: 0;
}

.meta dt {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.meta dd {
    margin: 2px 0 0;
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.meta .meta-wide {
    grid-column: 1 / -1;
}

.target-code {
    color: var(--accent, var(--text));
}


/* ----- Sendezeit UTC + MEZ ----- */

.schedule {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.time-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.time-grid > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 11px;
    border-radius: 11px;
    background: var(--surface-2);
}

.time-grid .is-utc {
    background: var(--blue-soft);
}

.tz {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.is-utc .tz {
    color: var(--blue);
}

.time-grid strong {
    font-family: var(--mono);
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
}

.day-tag {
    margin-left: 6px;
    color: var(--muted);
    font-family: inherit;
    font-size: 10.5px;
    font-style: normal;
    font-weight: 600;
}

.progress {
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf1f6;
}

.progress > span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green), #46dc9c);
    transition: width 1s linear, background 0.4s ease;
}

[data-state="on"] .progress > span {
    background: linear-gradient(90deg, var(--green), #46dc9c, var(--green));
    background-size: 200% 100%;
    animation: flow 2.6s linear infinite;
}

[data-state="ending"] .progress > span {
    background: linear-gradient(90deg, var(--amber), #fdb022);
}

[data-state="soon"] .progress > span {
    background: linear-gradient(90deg, #6b9bff, var(--blue));
}

[data-state="ended"] .progress > span {
    background: #aab6c3;
}

.remaining {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--green-dark);
}

[data-state="ending"] .remaining { color: var(--amber-dark); }
[data-state="soon"]   .remaining { color: var(--blue-dark); }
[data-state="ended"]  .remaining { color: var(--muted); }


/* ----- WebSDR ----- */

.websdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding: 11px 14px;
    border: 1px solid #b9ebd1;
    border-radius: 12px;
    background: var(--green-soft);
    color: var(--green-dark);
    font-size: 13px;
    font-weight: 750;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.websdr b {
    font-size: 15px;
    transition: transform 0.2s ease;
}

.websdr:hover {
    border-color: var(--green);
    background: var(--green);
    box-shadow: 0 8px 18px rgba(18, 183, 106, 0.28);
    color: #fff;
}

.websdr:hover b {
    transform: translate(3px, -3px);
}

.no-websdr {
    margin-top: auto;
    padding: 10px;
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    color: var(--muted);
    font-size: 11.5px;
    text-align: center;
}


/* ==========================================================
   LEER / FEHLER
   ========================================================== */

.empty {
    grid-column: 1 / -1;
    padding: 56px 20px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
    text-align: center;
}

.empty-symbol {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 36px;
}

.empty h2 {
    margin: 0 0 6px;
    font-size: 20px;
}

.empty p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.empty .reset {
    margin-top: 16px;
}

.error-box {
    padding: 22px;
    border: 1px solid #f0b7b7;
    border-radius: 12px;
    background: #fff5f5;
    color: #b53636;
}


/* ==========================================================
   FOOTER
   ========================================================== */

footer {
    margin-top: 30px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
    text-align: center;
}


/* ==========================================================
   ANIMATIONEN
   ========================================================== */

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(var(--pulse, 229, 56, 59), 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(var(--pulse, 229, 56, 59), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--pulse, 229, 56, 59), 0); }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

@keyframes wave {
    0%, 100% { opacity: 0.2; }
    30%      { opacity: 1; }
}

@keyframes flow {
    from { background-position: 0 0; }
    to   { background-position: -200% 0; }
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

@keyframes reveal {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}


/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 700px) {

    .radiodx-wrapper {
        width: calc(100% - 20px);
        padding-top: 14px;
    }

    .logo-title {
        font-size: 22px;
    }

    .clocks {
        width: 100%;
    }

    .clock {
        flex: 1 1 0;
        min-width: 0;
    }

    .filters {
        padding: 12px;
    }

    .filter-group {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .filter-label {
        padding-top: 0;
    }

    /* Chips einzeilig, seitlich scrollbar */
    .chips {
        flex-wrap: nowrap;
        margin: 0 -12px;
        padding: 2px 12px 6px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .chips::-webkit-scrollbar {
        display: none;
    }

    .chip {
        flex: 0 0 auto;
    }

    .sort {
        flex: 1 1 auto;
    }

    .sort select {
        flex: 1;
    }

    .stat-meta {
        width: 100%;
        margin-left: 0;
    }

    .station-list {
        grid-template-columns: 1fr;
    }
}
