/* ===========================================================
   Drivstoffkart – design-tokens
   Palett hentet fra veiskilt/pumpe-verden: asfalt, pumpegul,
   samt grønn/rød for billig/dyr pris. Ingen cream+terrakotta-klisjé.
   =========================================================== */
:root {
    --asphalt: #1B1F24;
    --asphalt-2: #262B32;
    --asphalt-3: #333A42;
    --paper: #EEF1EF;
    --card: #FFFFFF;
    --ink: #1B1F24;
    --ink-muted: #5B6570;
    --line: #DCE1E0;

    --amber: #F2A93B;
    --amber-ink: #4A3005;
    --green: #2F6F4E;
    --green-bg: #E4F1E9;
    --red: #C1443C;
    --red-bg: #FBE7E5;

    --radius-s: 6px;
    --radius-m: 10px;
    --shadow-card: 0 1px 2px rgba(27,31,36,.06), 0 8px 24px rgba(27,31,36,.08);

    --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
    --font-body: 'IBM Plex Sans', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); margin: 0 0 .4em; line-height: 1.15; letter-spacing: -.01em; }
p { line-height: 1.55; }
a { color: inherit; }
.muted { color: var(--ink-muted); font-size: .93rem; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- Topbar ---------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; height: 60px;
    background: var(--asphalt); color: #fff;
    position: sticky; top: 0; z-index: 500;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-mark { display: flex; color: var(--amber); }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; }
.topnav { display: flex; align-items: center; gap: 8px; }
.topnav-link {
    color: #C9CFD4; text-decoration: none; font-size: .93rem; padding: 8px 10px; border-radius: var(--radius-s);
}
.topnav-link:hover { color: #fff; }
.topnav-link.active { color: #fff; background: rgba(255,255,255,.08); }
.topnav-user { color: #C9CFD4; font-size: .88rem; padding: 0 4px; }
.topnav-toggle { display: none; background: none; border: 0; color: #fff; padding: 6px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font-family: var(--font-body); font-weight: 600; font-size: .92rem;
    padding: 9px 16px; border-radius: var(--radius-s); border: 1px solid transparent;
    text-decoration: none; cursor: pointer; transition: background-color .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--amber); color: var(--amber-ink); }
.btn-primary:hover { background: #E7981F; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.28); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-small { padding: 6px 12px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- Layout: kart + sidebar ---------- */
.map-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    height: calc(100vh - 60px);
}
.sidebar {
    background: var(--card);
    border-right: 1px solid var(--line);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.sidebar-head { padding: 20px 20px 8px; }
.sidebar-head h1 { font-size: 1.35rem; }
.sidebar-controls { padding: 4px 20px 12px; display: flex; flex-direction: column; gap: 10px; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 600; color: var(--ink-muted); }
.field input, .field select {
    font-family: var(--font-body); font-size: .95rem; color: var(--ink);
    padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff;
}
.field input:focus, .field select:focus { border-color: var(--amber); }
.field-compact input { padding: 7px 9px; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; padding: 4px 20px 12px; border-bottom: 1px solid var(--line); }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--ink-muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-low { background: var(--green); }
.dot-mid { background: var(--amber); }
.dot-high { background: var(--red); }
.dot-none { background: #B9C0C2; }

.list-hint { padding: 0 20px 8px; font-size: .78rem; }

.station-list { list-style: none; margin: 0; padding: 6px 0; overflow-y: auto; flex: 1; }
.station-list-empty { padding: 24px 20px; color: var(--ink-muted); font-size: .9rem; }
.station-row {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
    padding: 12px 20px; border: 0; background: none; cursor: pointer;
    border-left: 3px solid transparent; border-bottom: 1px solid #F1F3F2;
}
.station-row:hover, .station-row.active { background: var(--paper); }
.station-row.tier-low { border-left-color: var(--green); }
.station-row.tier-mid { border-left-color: var(--amber); }
.station-row.tier-high { border-left-color: var(--red); }
.station-row.tier-none { border-left-color: #B9C0C2; }
.station-row-main { flex: 1; min-width: 0; }
.station-row-name { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.station-row-sub { font-size: .8rem; color: var(--ink-muted); margin-top: 2px; }
.station-row-price { text-align: right; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; white-space: nowrap; }
.station-row-price small { display: block; font-family: var(--font-body); font-weight: 500; font-size: .68rem; color: var(--ink-muted); }

/* ---------- Kart ---------- */
.map-wrap { position: relative; }
#map, #pickMap { width: 100%; height: 100%; background: #dfe3e2; }
.leaflet-popup-content-wrapper { border-radius: var(--radius-m); }
.station-marker { display: flex; align-items: center; justify-content: center; }
.station-marker-pin {
    width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
    display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,.35);
    border: 2px solid #fff;
}
.station-marker-pin.tier-low { background: var(--green); }
.station-marker-pin.tier-mid { background: var(--amber); }
.station-marker-pin.tier-high { background: var(--red); }
.station-marker-pin.tier-none { background: #8B9296; }
.station-marker-pin svg { transform: rotate(45deg); color: #fff; width: 14px; height: 14px; }

.map-loading {
    position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 400;
    background: var(--asphalt); color: #fff; font-size: .8rem; font-weight: 600;
    padding: 7px 16px; border-radius: 999px; box-shadow: var(--shadow-card);
}

.osm-credit { font-size: .75rem; color: var(--ink-muted); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 16px; }
.osm-credit a { color: var(--amber-ink); font-weight: 600; }

.fab {
    position: absolute; right: 20px; bottom: 28px; z-index: 400;
    width: 54px; height: 54px; border-radius: 50%;
    background: var(--amber); color: var(--amber-ink);
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-card); text-decoration: none;
}
.fab:hover { background: #E7981F; }

/* ---------- Bunnark (station sheet) ---------- */
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 600;
    background: var(--card); border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.18);
    max-height: 72vh; overflow-y: auto; padding: 10px 22px 26px;
}
.sheet[hidden] { display: none; }
.sheet-drag { width: 40px; height: 4px; background: var(--line); border-radius: 2px; margin: 4px auto 10px; }
.sheet-close {
    position: absolute; top: 12px; right: 16px; border: 0; background: none; font-size: 1.1rem; color: var(--ink-muted); cursor: pointer;
}
.sheet-title { font-size: 1.2rem; margin-bottom: 2px; }
.sheet-meta { color: var(--ink-muted); font-size: .88rem; margin-bottom: 14px; }
.sheet-prices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
.price-tile { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 10px 12px; }
.price-tile-label { font-size: .78rem; color: var(--ink-muted); margin-bottom: 2px; }
.price-tile-value { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; }
.price-tile-value.empty { color: var(--ink-muted); font-size: 1rem; font-weight: 500; }
.price-tile-age { font-size: .72rem; color: var(--ink-muted); margin-top: 2px; }

.price-form h3 { font-size: 1rem; margin-bottom: 10px; }
.price-form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.form-status { min-height: 1.2em; font-size: .85rem; margin-top: 8px; }
.form-status.ok { color: var(--green); }
.form-status.error { color: var(--red); }
.login-hint { font-size: .88rem; color: var(--ink-muted); border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.login-hint a { color: var(--amber-ink); font-weight: 600; }

/* ---------- Auth / skjema-sider ---------- */
.auth-page, .form-page {
    max-width: 480px; margin: 0 auto; padding: 48px 20px 60px;
}
.form-page { max-width: 640px; }
.auth-card, .form-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-m);
    padding: 32px; box-shadow: var(--shadow-card);
}
.stack-form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.auth-switch { margin-top: 18px; font-size: .9rem; color: var(--ink-muted); }
.auth-switch a { font-weight: 600; color: var(--amber-ink); }
#pickMap { height: 320px; border-radius: var(--radius-m); margin: 16px 0; border: 1px solid var(--line); }

.alert { padding: 10px 14px; border-radius: var(--radius-s); font-size: .9rem; margin: 14px 0 0; }
.alert-error { background: var(--red-bg); color: var(--red); }
.alert-success { background: var(--green-bg); color: var(--green); }

.map-toggle { display: none; }

/* ---------- Responsiv ---------- */
@media (max-width: 880px) {
    .topnav {
        position: absolute; top: 60px; left: 0; right: 0; background: var(--asphalt);
        flex-direction: column; align-items: stretch; padding: 8px 16px 16px; gap: 4px;
        display: none;
    }
    .topnav.open { display: flex; }
    .topnav-toggle { display: block; }
    .topnav-user { padding: 8px 10px; }

    .map-layout { grid-template-columns: 1fr; grid-template-rows: 1fr; height: calc(100vh - 60px); }
    .sidebar { position: absolute; inset: 0; z-index: 350; transform: translateY(0); }
    .map-wrap { position: absolute; inset: 0; }
    .sidebar.map-mode { display: none; }

    .map-toggle {
        position: absolute; top: 16px; left: 16px; z-index: 400;
        background: var(--asphalt); color: #fff; border: 0; border-radius: 999px;
        padding: 10px 16px; font-weight: 600; font-size: .85rem; box-shadow: var(--shadow-card);
    }
}
