/* css/style.css — Fuel Tactical */

/* ── DARK MODE (default) ─────────────────────────────────────────────────────── */
:root {
    --accent:    #2979ff;
    --bg:        #080808;
    --surface:   #0f0f0f;
    --border:    rgba(255,255,255,0.07);
    --text:      #e8e8e8;
    --text-dim:  #555;
    --danger:    #ff3b30;
    --success:   #00e676;
    --header-bg: rgba(8,8,8,0.92);
    --card-bg:   #000;
    --modal-bg:  rgba(0,0,0,0.88);
    --select-opt:#111;
    --legend-bg: rgba(8,8,8,0.85);
    --mono:      'IBM Plex Mono', monospace;
    --sans:      'IBM Plex Sans', sans-serif;
    --sidebar:   300px;
    --header:    48px;
}

/* ── LIGHT MODE ──────────────────────────────────────────────────────────────── */
html.light {
    --accent:    #1565c0;
    --bg:        #f0f2f5;
    --surface:   #ffffff;
    --border:    rgba(0,0,0,0.10);
    --text:      #1a1a1a;
    --text-dim:  #999;
    --danger:    #d32f2f;
    --success:   #2e7d32;
    --header-bg: rgba(255,255,255,0.94);
    --card-bg:   #fafafa;
    --modal-bg:  rgba(0,0,0,0.50);
    --select-opt:#fff;
    --legend-bg: rgba(255,255,255,0.92);
}

/* ── BASE ────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body, html {
    height: 100%; background: var(--bg); color: var(--text);
    font-family: var(--sans); overflow: hidden;
    transition: background .25s, color .25s;
}

/* ── HEADER ──────────────────────────────────────────────────────────────────── */
header {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--header); z-index: 100;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 20px; gap: 0;
    transition: background .25s, border-color .25s;
}
.brand {
    font-family: var(--mono); font-size: 13px; font-weight: 600;
    letter-spacing: 3px; display: flex; align-items: center; gap: 12px;
}
.brand span { color: var(--accent); }
.status-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--success); box-shadow: 0 0 8px var(--success);
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.header-spacer { flex: 1; }

.nav-group { display: flex; align-items: center; gap: 8px; margin-left: 16px; }
.nav-group span {
    font-family: var(--mono); font-size: 10px; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 1px;
}

/* PLZ search */
.plz-group { display: flex; align-items: center; gap: 6px; margin-left: 16px; }
.plz-input {
    background: transparent; border: 1px solid var(--border);
    color: var(--text); font-family: var(--mono); font-size: 11px;
    padding: 6px 10px; border-radius: 4px; outline: none; transition: .2s;
    width: 130px;
}
.plz-input::placeholder { color: var(--text-dim); }
.plz-input:hover, .plz-input:focus { border-color: var(--accent); }
.plz-btn {
    background: var(--accent); border: none; color: #fff;
    font-family: var(--mono); font-size: 10px; font-weight: 600;
    letter-spacing: 1px; padding: 6px 12px; border-radius: 4px;
    cursor: pointer; transition: filter .2s;
}
.plz-btn:hover { filter: brightness(1.15); }
.plz-error {
    font-family: var(--mono); font-size: 9px; color: var(--danger);
    letter-spacing: 1px; white-space: nowrap;
}

select {
    background: transparent; border: 1px solid var(--border);
    color: var(--text); font-family: var(--mono); font-size: 11px;
    padding: 6px 10px; border-radius: 4px; outline: none;
    transition: .2s; cursor: pointer;
}
select:hover { border-color: var(--accent); }
option { background: var(--select-opt); color: var(--text); }

/* Language toggle */
.lang-toggle {
    margin-left: 16px; display: flex; align-items: center;
    border: 1px solid var(--border); border-radius: 4px; overflow: hidden;
}
.lang-btn {
    background: transparent; border: none; color: var(--text-dim);
    font-family: var(--mono); font-size: 10px; letter-spacing: 1px;
    padding: 6px 10px; cursor: pointer; transition: .15s;
}
.lang-btn.active { background: var(--accent); color: #fff; }
.lang-btn:hover:not(.active) { color: var(--text); }

/* Theme toggle — matches lang-toggle style exactly */
.theme-toggle {
    margin-left: 10px; display: flex; align-items: center;
    border: 1px solid var(--border); border-radius: 4px; overflow: hidden;
}
.theme-btn {
    background: transparent; border: none; color: var(--text-dim);
    font-family: var(--mono); font-size: 10px; letter-spacing: 1px;
    padding: 6px 10px; cursor: pointer; transition: .15s;
}
.theme-btn.active { background: var(--surface2, rgba(255,255,255,0.08)); color: var(--text); }
html.light .theme-btn.active { background: rgba(0,0,0,0.07); color: var(--text); }
.theme-btn:hover:not(.active) { color: var(--text); }

/* ── LAYOUT ──────────────────────────────────────────────────────────────────── */
#layout { position: fixed; top: var(--header); left: 0; right: 0; bottom: 0; display: flex; }
#map { flex: 1; }

/* ── SIDEBAR ─────────────────────────────────────────────────────────────────── */
#sidebar {
    width: var(--sidebar); background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: 14px; gap: 12px; flex-shrink: 0;
    transition: background .25s, border-color .25s;
}
.sidebar-header {
    font-family: var(--mono); font-size: 10px; color: var(--text-dim);
    letter-spacing: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.sidebar-sub {
    font-family: var(--mono); font-size: 9px; color: var(--text-dim);
    letter-spacing: 1px; margin-top: 2px;
}
.station-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 2px; }
.station-list::-webkit-scrollbar { width: 3px; }
.station-list::-webkit-scrollbar-thumb { background: var(--border); }

.cam-card {
    border: 1px solid var(--border); background: var(--card-bg);
    border-radius: 6px; padding: 14px 12px; cursor: pointer;
    transition: border-color .15s, box-shadow .15s, background .25s;
    position: relative; flex-shrink: 0;
}
.cam-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cam-card.active { border-color: var(--success); box-shadow: 0 0 0 1px var(--success); }
.rank-badge {
    position: absolute; top: 10px; right: 10px;
    font-family: var(--mono); font-size: 9px; color: var(--text-dim); letter-spacing: 1px;
}
.price-text { font-family: var(--mono); font-size: 18px; font-weight: 600; display: block; margin-bottom: 8px; }
.cam-label strong { display: block; font-size: 11px; color: var(--text); margin-bottom: 3px; text-transform: uppercase; }
.cam-label span { font-size: 9px; font-family: var(--mono); color: var(--text-dim); text-transform: uppercase; }

/* ── CONNECTOR CANVAS ────────────────────────────────────────────────────────── */
#connector-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 99; }

/* ── DOSSIER MODAL ───────────────────────────────────────────────────────────── */
#modal {
    position: fixed; inset: 0;
    background: var(--modal-bg); z-index: 1000;
    display: none; justify-content: center; align-items: center;
    backdrop-filter: blur(8px);
}
#dossier {
    width: 92vw; max-width: 680px; max-height: 90vh;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; display: flex; flex-direction: column; overflow: hidden;
    transition: background .25s;
}
.d-header { padding: 24px 28px 0; flex-shrink: 0; }
.d-id { font-family: var(--mono); font-size: 10px; color: var(--accent); letter-spacing: 2px; margin-bottom: 6px; }
.d-title { font-size: 16px; font-weight: 600; text-transform: uppercase; margin-bottom: 16px; }
.d-body { flex: 1; overflow-y: auto; padding: 0 28px 24px; }
.d-body::-webkit-scrollbar { width: 3px; }
.d-body::-webkit-scrollbar-thumb { background: var(--border); }

.d-table { display: flex; flex-direction: column; margin-bottom: 20px; }
.d-row { display: flex; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--border); }
.d-row:last-child { border-bottom: none; }
.d-key { font-family: var(--mono); font-size: 9px; color: var(--text-dim); letter-spacing: 2px; text-transform: uppercase; width: 40%; flex-shrink: 0; }
.d-val { font-family: var(--mono); font-size: 11px; color: var(--text); }

.chart-section { margin-bottom: 20px; }
.chart-tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.chart-tab {
    font-family: var(--mono); font-size: 10px; letter-spacing: 1px;
    padding: 6px 12px; border: 1px solid var(--border);
    background: transparent; color: var(--text-dim);
    border-radius: 3px; cursor: pointer; transition: .15s;
}
.chart-tab:hover { border-color: var(--accent); color: var(--accent); }
.chart-tab.active { border-color: var(--accent); color: var(--accent); background: rgba(41,121,255,0.1); }
.chart-wrap { height: 160px; position: relative; }

.d-footer { padding: 16px 28px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-shrink: 0; }
.btn {
    flex: 1; padding: 10px; border-radius: 4px;
    font-family: var(--mono); font-size: 10px; font-weight: 600;
    letter-spacing: 1px; cursor: pointer; transition: filter .2s;
    text-decoration: none; text-align: center; border: none;
}
.btn-google { background: #34A853; color: #fff; }
.btn-google:hover { filter: brightness(1.15); }
.btn-apple { background: #0066CC; color: #fff; }
.btn-apple:hover { filter: brightness(1.15); }
.btn-secondary { background: transparent; color: var(--text-dim); border: 1px solid var(--border) !important; }
.btn-secondary:hover { border-color: var(--text) !important; color: var(--text); }

/* ── LEGEND ──────────────────────────────────────────────────────────────────── */
.legend {
    position: absolute; bottom: 30px; left: 14px;
    background: var(--legend-bg); border: 1px solid var(--border);
    border-radius: 6px; padding: 10px 12px;
    font-family: var(--mono); font-size: 9px; color: var(--text-dim);
    z-index: 10; letter-spacing: 1px;
    transition: background .25s;
}
.legend-bar {
    width: 120px; height: 6px; border-radius: 3px;
    background: linear-gradient(to right, #00e676, #ffd600, #ff3b30);
    margin: 6px 0 4px;
}
.legend-labels { display: flex; justify-content: space-between; }

/* ── IMPRESSUM MODAL ─────────────────────────────────────────────────────────── */
#impressum-modal {
    position: fixed; inset: 0;
    background: var(--modal-bg); z-index: 2000;
    display: none; justify-content: center; align-items: center;
    backdrop-filter: blur(8px);
}
.impressum-box {
    width: 90vw; max-width: 450px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 28px; font-family: var(--mono);
    transition: background .25s;
}
.impressum-title { font-size: 16px; font-weight: 600; margin-bottom: 20px; color: var(--text); }
.impressum-body { font-size: 11px; color: var(--text); line-height: 1.8; text-align: left; }

/* ── MOBILE ───────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    /* Header: two rows */
    header {
        height: auto;
        flex-wrap: wrap;
        padding: 8px 12px;
        gap: 6px;
        row-gap: 6px;
    }
    /* Row 1: brand + spacer + lang + theme */
    .brand { font-size: 11px; letter-spacing: 2px; gap: 8px; }
    .status-dot { width: 5px; height: 5px; }
    .lang-toggle { margin-left: auto; }
    .theme-toggle { margin-left: 6px; }

    /* Row 2: PLZ search + fuel selector — full width */
    .plz-group {
        order: 10;           /* push to second row */
        width: 100%;
        margin-left: 0;
        flex: 1 1 100%;
    }
    .plz-input { flex: 1; width: auto; min-width: 0; font-size: 14px; padding: 8px 10px; }
    .plz-btn   { font-size: 12px; padding: 8px 14px; }

    .nav-group {
        order: 11;
        margin-left: 0;
        flex: 1 1 100%;
        width: 100%;
    }
    .nav-group span { display: none; }   /* hide "TREIBSTOFF" label */
    select { width: 100%; font-size: 14px; padding: 8px 10px; }

    /* Push header-spacer so it doesn't eat up row 1 */
    .header-spacer { display: none; }

    /* Adjust layout top offset to new header height (~88px) */
    :root { --header: 88px; }

    /* Stack map above, sidebar below */
    #layout { flex-direction: column; }

    #map { flex: 0 0 55vh; }

    /* Sidebar becomes a bottom sheet */
    #sidebar {
        width: 100%;
        flex: 1;
        border-left: none;
        border-top: 1px solid var(--border);
        padding: 10px 12px;
        overflow-y: auto;
        gap: 8px;
    }

    /* Station cards: horizontal compact layout */
    .cam-card { padding: 10px 12px; }
    .price-text { font-size: 16px; margin-bottom: 4px; }
    .cam-label strong { font-size: 11px; }
    .cam-label span   { font-size: 9px; }

    /* Legend: above sidebar */
    .legend { bottom: calc(45vh + 10px); }

    /* Modal: full screen on mobile */
    #dossier {
        width: 100vw; max-width: 100vw;
        max-height: 95vh;
        border-radius: 12px 12px 0 0;
        margin-top: auto;
    }
    #modal { align-items: flex-end; }
    .d-footer { flex-wrap: wrap; }
    .d-footer .btn { flex: 1 1 calc(50% - 4px); min-width: 0; }
}

