/* ══════════════════════════════════════════════════════════════
   CKE DigiSign — Campingplatz Krautsand am Elbstrand
   Design: Hell, maritim, Naturfarben — passend zur Website
   ══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* ── Custom Properties ────────────────────────────────────── */
:root {
    /* Haupt-Palette */
    --ck-navy:       #0d1b2a;     /* Dunkelblau Logo */
    --ck-blue:       #3ba9d6;     /* Maritimes Blau (Elbe) */
    --ck-blue-dark:  #2a8ab5;
    --ck-blue-light: #d0edf8;
    --ck-green:      #4a7c59;     /* Naturgrün */
    --ck-green-light:#e8f5ea;
    --ck-sand:       #e8d5a3;     /* Sandstrand */
    --ck-sand-light: #f7f0de;
    --ck-orange:     #e8833a;     /* Sonnenuntergang / Banner */
    --ck-orange-light: #fdebd0;
    --ck-red:        #c0392b;
    --ck-red-light:  #fdecea;

    /* Hintergrund & Karten */
    --bg:            #f0f6fa;     /* Sehr helles Blau-Weiß */
    --card-bg:       #ffffff;
    --card-border:   rgba(59,169,214,.2);
    --card-shadow:   0 4px 24px rgba(13,27,42,.08);

    /* Text */
    --text-dark:     #0d1b2a;
    --text-body:     #2c3e50;
    --text-muted:    #6b7a8d;

    /* Layout */
    --header-h:      64px;
    --footer-h:      52px;
    --gap:           12px;
    --radius:        14px;
}

/* ── Reset / Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text-body);
    font-size: 16px;
}

/* ══════════════════════════════════════════════════════════════
   LAYOUT GRID
   ══════════════════════════════════════════════════════════════ */

.digisign-root {
    display: grid;
    grid-template-rows: auto auto 1fr var(--footer-h);
    /* banner (cond.) | header | main | footer */
    width: 100vw;
    height: 100vh;
    gap: 0;
}

/* ── Info-Banner ──────────────────────────────────────────── */
#banner-strip {
    background: linear-gradient(90deg, var(--ck-orange) 0%, #d4622a 100%);
    color: #fff;
    font-weight: 800;
    font-size: clamp(.85rem, 1.6vw, 1.15rem);
    text-align: center;
    padding: .5rem 2rem;
    display: none; /* JS einblenden */
    animation: bannerSlideIn .6s ease forwards;
    letter-spacing: .3px;
    flex-shrink: 0;
}
#banner-strip.visible { display: block; }
@keyframes bannerSlideIn {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}
#banner-strip .banner-icon { margin-right: .5rem; }

/* ── Header ───────────────────────────────────────────────── */
.ck-header {
    background: var(--ck-navy);
    height: var(--header-h);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    flex-shrink: 0;
    position: relative;
}
.ck-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--ck-blue) 0%, var(--ck-green) 50%, var(--ck-blue) 100%);
}
.ck-logo {
    height: 44px;
    filter: brightness(0) invert(1); /* Weißes Logo auf dunklem BG */
    object-fit: contain;
}
.ck-header-title {
    color: #fff;
    font-weight: 900;
    font-size: clamp(.9rem, 1.8vw, 1.25rem);
    line-height: 1.2;
    letter-spacing: .3px;
}
.ck-header-title span {
    color: var(--ck-blue);
    font-size: .8em;
    font-weight: 600;
    display: block;
}
.ck-header-spacer { flex: 1; }
.ck-header-badge {
    background: rgba(59,169,214,.15);
    border: 1px solid rgba(59,169,214,.4);
    color: var(--ck-blue);
    border-radius: 20px;
    padding: .3rem .9rem;
    font-size: clamp(.7rem, 1.2vw, .85rem);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .4rem;
}

/* ── Main Grid (center area) ──────────────────────────────── */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 0.8fr 1.5fr;
    grid-template-rows: 1fr;
    gap: var(--gap);
    padding: var(--gap);
    overflow: hidden;
    min-height: 0;
}

/* Spalte 1: Wetter + Pegel + Imbiss */
.col-1 {
    display: grid;
    grid-template-rows: 1fr 1fr 1fr;
    gap: var(--gap);
    min-height: 0;
}

/* Spalte 2: Webcam (klein) + Veranstaltungen */
.col-2 {
    display: grid;
    grid-template-rows: 0.7fr 1.5fr;
    gap: var(--gap);
    min-height: 0;
}

/* Spalte 3: Schiffsverkehr volle Höhe */
.col-3 {
    display: grid;
    grid-template-rows: 1fr;
    min-height: 0;
}



/* ── Bottom Row (Pegel + Imbiss) ──────────────────────────── */
.bottom-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gap);
    padding: 0 var(--gap) var(--gap);
    overflow: hidden;
    min-height: 0;
}

/* ── Widget Card ──────────────────────────────────────────── */
.widget {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.widget-header {
    background: linear-gradient(135deg, var(--ck-navy) 0%, #1a3048 100%);
    color: #fff;
    padding: .55rem 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 800;
    font-size: clamp(.75rem, 1.3vw, .95rem);
    flex-shrink: 0;
    letter-spacing: .3px;
}
.widget-header .wh-icon {
    font-size: clamp(1rem, 1.8vw, 1.3rem);
}
.widget-header .wh-badge {
    margin-left: auto;
    background: rgba(59,169,214,.25);
    color: var(--ck-blue);
    border-radius: 12px;
    padding: .15rem .6rem;
    font-size: .75em;
    font-weight: 700;
}

.widget-body {
    flex: 1;
    padding: .75rem 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
}

/* ══════════════════════════════════════════════════════════════
   WIDGET: WETTER
   ══════════════════════════════════════════════════════════════ */

#weather-widget .widget-header { background: linear-gradient(135deg, #1565c0 0%, #1e88e5 100%); }

#weather-widget .widget-body {
    padding: .6rem .7rem;
    justify-content: space-between;
    gap: .6rem;
}

.weather-current {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: .5rem .8rem;
}
.weather-icon-big {
    font-size: clamp(2.2rem, 4.5vw, 3rem);
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.15));
}
.weather-temp-block { min-width: 0; }
.weather-temp-big {
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 900;
    color: var(--ck-navy);
    line-height: 1;
}
.weather-temp-big sup {
    font-size: .45em;
    font-weight: 700;
    color: var(--text-muted);
}
.weather-desc {
    font-size: clamp(.7rem, 1.1vw, .85rem);
    color: var(--text-muted);
    font-weight: 700;
    margin-top: .1rem;
}
.weather-meta {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    text-align: right;
    color: var(--text-muted);
    font-size: clamp(.62rem, .95vw, .75rem);
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
}

/* 4-Tages-Forecast */
.weather-forecast {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .35rem;
    overflow: hidden;
}
.forecast-day {
    flex: 1;
    min-width: 0;
    background: var(--ck-blue-light);
    border-radius: 8px;
    padding: .3rem .2rem;
    text-align: center;
    font-size: clamp(.55rem, .8vw, .7rem);
}
.forecast-day .fc-day { font-weight: 800; color: var(--ck-navy); }
.forecast-day .fc-icon { font-size: clamp(.9rem, 1.6vw, 1.2rem); margin: .1rem 0; }
.forecast-day .fc-temps { color: var(--text-body); font-weight: 700; }
.forecast-day .fc-max { color: var(--ck-navy); }
.forecast-day .fc-min { color: var(--text-muted); font-size: .9em; }

/* Loading/Error States */
.widget-loading {
    display: flex; align-items: center; justify-content: center;
    gap: .5rem; color: var(--text-muted); font-size: .9rem;
    padding: 1rem;
}
.spinner {
    width: 1.2rem; height: 1.2rem;
    border: 3px solid var(--ck-blue-light);
    border-top-color: var(--ck-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════
   WIDGET: SCHIFFSVERKEHR
   ══════════════════════════════════════════════════════════════ */

#ship-widget .widget-header { background: linear-gradient(135deg, #0d47a1 0%, #1565c0 100%); }

#ship-widget .widget-body {
    padding: 0;
    overflow: hidden;
}
#ship-map {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* WEBCAM Widget */
#webcam-widget .widget-header { background: linear-gradient(135deg, #4a7c59 0%, #6aa776 100%); }
#webcam-widget .widget-header .wh-badge {
    background: rgba(255,255,255,.25);
    color: #fff;
}
#webcam-widget .widget-body {
    padding: 0;
    overflow: hidden;
    background: #0d1b2a;
    align-items: center;
    justify-content: center;
}
#webcam-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ══════════════════════════════════════════════════════════════
   WIDGET: WASSERSTAND
   ══════════════════════════════════════════════════════════════ */

#pegel-widget .widget-header { background: linear-gradient(135deg, #00695c 0%, #00897b 100%); }

.pegel-main {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    height: 100%;
    justify-content: center;
}

/* Tide-Anzeige (Ebbe/Flut) */
.tide-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .55rem .7rem;
    border-radius: 12px;
    border: 2px solid;
}
.tide-display.tide-up   { background: #fde7e7; border-color: #e53935; color: #b71c1c; }
.tide-display.tide-down { background: #e3f2fd; border-color: #1e88e5; color: #0d47a1; }
.tide-display.tide-flat { background: #f5f5f5; border-color: #9e9e9e; color: #424242; }
.tide-icon {
    font-size: clamp(1.2rem, 2.2vw, 1.8rem);
    font-weight: 900;
    line-height: 1;
}
.tide-info { text-align: left; line-height: 1.15; }
.tide-label {
    font-size: clamp(.7rem, 1.1vw, .85rem);
    font-weight: 800;
}
.tide-rate {
    font-size: clamp(.6rem, .9vw, .72rem);
    font-weight: 600;
    opacity: .8;
}

.pegel-value {
    font-size: clamp(1.6rem, 3.2vw, 2.6rem);
    font-weight: 900;
    color: var(--ck-navy);
    line-height: 1;
}
.pegel-unit {
    font-size: .35em;
    font-weight: 700;
    color: var(--text-muted);
}
.pegel-station {
    font-size: clamp(.55rem, .85vw, .7rem);
    color: var(--text-muted);
    font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════
   WIDGET: IMBISS
   ══════════════════════════════════════════════════════════════ */

#imbiss-widget .widget-header {
    background: linear-gradient(135deg, var(--ck-green) 0%, #2e7d32 100%);
}

.imbiss-status {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .3rem;
    height: 100%;
    text-align: center;
}
.imbiss-badge {
    font-size: clamp(1rem, 2.2vw, 1.5rem);
    font-weight: 900;
    padding: .4rem 1.2rem;
    border-radius: 50px;
    letter-spacing: .5px;
}
.imbiss-badge.open {
    background: var(--ck-green-light);
    color: var(--ck-green);
    border: 2px solid var(--ck-green);
}
.imbiss-badge.closed {
    background: var(--ck-red-light);
    color: var(--ck-red);
    border: 2px solid var(--ck-red);
}
.imbiss-zeiten {
    font-size: clamp(.7rem, 1.3vw, .9rem);
    color: var(--text-muted);
    font-weight: 700;
}
.imbiss-event-note {
    margin-top: .35rem;
    font-size: clamp(.65rem, 1.05vw, .8rem);
    color: var(--ck-orange);
    font-weight: 800;
}

/* ══════════════════════════════════════════════════════════════
   WIDGET: EVENTS
   ══════════════════════════════════════════════════════════════ */

#events-widget .widget-header {
    background: linear-gradient(135deg, #6a3d9a 0%, #7b4ea0 100%);
}

.events-list {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    overflow: hidden;
    flex: 1;
}
.event-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    background: linear-gradient(90deg, var(--ck-sand-light) 0%, #fff 100%);
    border-left: 4px solid var(--ck-sand);
    border-radius: 8px;
    padding: .4rem .75rem;
    min-height: 0;
    flex-shrink: 0;
}
.event-item:first-child {
    background: linear-gradient(90deg, #fff8e1 0%, #fff 100%);
    border-left-color: var(--ck-orange);
}
.event-emoji { font-size: clamp(.9rem, 1.8vw, 1.3rem); flex-shrink: 0; }
.event-info  { flex: 1; min-width: 0; }
.event-title {
    font-weight: 800;
    color: var(--ck-navy);
    font-size: clamp(.7rem, 1.25vw, .9rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.event-meta {
    font-size: clamp(.6rem, 1vw, .75rem);
    color: var(--text-muted);
    font-weight: 600;
}
.event-date-badge {
    flex-shrink: 0;
    background: var(--ck-navy);
    color: #fff;
    border-radius: 8px;
    padding: .2rem .5rem;
    text-align: center;
    font-size: clamp(.55rem, .9vw, .72rem);
    font-weight: 800;
    line-height: 1.3;
}
.event-date-badge .edb-day  { font-size: 1.2em; }
.events-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 1rem;
    font-size: .9rem;
    font-style: italic;
}

/* ══════════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════════ */

.ck-footer {
    background: var(--ck-navy);
    height: var(--footer-h);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    flex-shrink: 0;
    position: relative;
}
.ck-footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--ck-blue) 0%, var(--ck-green) 50%, var(--ck-blue) 100%);
}
.footer-brand {
    color: #fff;
    font-weight: 800;
    font-size: clamp(.75rem, 1.4vw, .95rem);
    display: flex;
    align-items: center;
    gap: .6rem;
    letter-spacing: .2px;
}
.footer-brand span { color: var(--ck-blue); }
.footer-spacer { flex: 1; }
.footer-coords {
    color: rgba(255,255,255,.45);
    font-size: clamp(.55rem, .9vw, .7rem);
    font-weight: 600;
    font-family: monospace;
}
#clock {
    color: #fff;
    font-size: clamp(1rem, 2.2vw, 1.5rem);
    font-weight: 900;
    letter-spacing: 1px;
    background: rgba(59,169,214,.15);
    border: 1px solid rgba(59,169,214,.3);
    border-radius: 10px;
    padding: .2rem .75rem;
    font-variant-numeric: tabular-nums;
}

/* ══════════════════════════════════════════════════════════════
   NEUES LAYOUT: 2-Spalten mit Bottom Row
   ══════════════════════════════════════════════════════════════ */

.digisign-root {
    grid-template-rows: auto auto 1fr var(--footer-h);
    /* banner | header | main-grid | footer */
}



/* ── Responsive Scaling (TV-only, keine mobile Anpassung nötig) ── */
@media (max-aspect-ratio: 16/10) {
    :root { --header-h: 56px; --footer-h: 46px; }
}

/* ── Subtle water wave decoration ── */
.water-deco {
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        var(--ck-blue) 0px, var(--ck-blue) 8px,
        transparent 8px, transparent 12px
    );
    opacity: .4;
}

/* ── Update-Indikator ── */
.update-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--ck-blue);
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .4; transform: scale(.7); }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet & Mobile
   ══════════════════════════════════════════════════════════════ */

/* TABLET: 2-Spalten-Layout */
@media (max-width: 1100px) {
    .main-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }
    .col-1 { grid-column: 1; grid-row: 1; }
    .col-2 { grid-column: 2; grid-row: 1; }
    .col-3 { grid-column: 1 / span 2; grid-row: 2; min-height: 50vh; }

    .col-1 { grid-template-rows: 1fr 1fr 1fr; }
    .col-2 { grid-template-rows: 0.8fr 1.2fr; }
}

/* MOBILE: alles untereinander */
@media (max-width: 720px) {
    html, body {
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }
    .digisign-root {
        height: auto;
        min-height: 100vh;
        grid-template-rows: auto auto auto auto;
    }
    .ck-header {
        flex-wrap: wrap;
        padding: .6rem .8rem;
        gap: .5rem;
    }
    .ck-logo { max-height: 40px; }
    .ck-header-title {
        font-size: 1rem;
        flex: 1 1 auto;
        min-width: 0;
    }
    .ck-header-title span {
        font-size: .65rem;
        display: block;
    }
    .ck-header-badge { font-size: .7rem; padding: .2rem .5rem; }

    .main-grid {
        display: flex;
        flex-direction: column;
        grid-template-columns: none;
        padding: 8px;
        gap: 8px;
        overflow: visible;
    }
    .col-1, .col-2, .col-3 {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .widget { min-height: 180px; }
    #ship-widget  { min-height: 320px; }
    #webcam-widget { min-height: 200px; }
    #events-widget { min-height: 240px; }

    .widget-header {
        padding: .5rem .7rem;
        font-size: .85rem;
    }
    .widget-body { padding: .6rem .7rem; }

    /* Wetter: kompakter */
    .weather-current { gap: .4rem; }
    .weather-meta { font-size: .65rem; }
    .weather-forecast { gap: .25rem; }

    /* Footer */
    .ck-footer {
        font-size: .7rem;
        padding: .4rem .6rem;
        flex-wrap: wrap;
        gap: .4rem;
    }
    .footer-coords { display: none; }
}

/* Sehr kleine Geräte: noch kompakter */
@media (max-width: 420px) {
    .ck-header-title { font-size: .9rem; }
    .ck-header-title span { display: none; }
    .ck-logo { max-height: 32px; }
    .widget { min-height: 160px; }
}
