/* ═══════════════════════════════════════
   CarbuPlav — Styles
   ═══════════════════════════════════════ */

:root {
    --bg: #f5f1ea;
    --surface: #ffffff;
    --surface-alt: #faf8f4;
    --border: #e2ddd4;
    --border-hover: #ccc6bb;
    --text: #1c1917;
    --text-secondary: #6b6560;
    --text-muted: #a39e97;
    --accent: #d95b2b;
    --accent-hover: #c04e22;
    --accent-light: #fdf2ec;
    --green: #1a7f5a;
    --green-light: #edf7f2;
    --green-dark: #145e43;
    --gold: #b8860b;
    --silver: #71717a;
    --bronze: #92572a;
    --red: #c53030;
    --red-light: #fef2f2;
    --purple: #6d28d9;
    --purple-light: #f3effe;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow: 0 2px 8px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.08);
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* ── HEADER ─────────────────────────── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.header-inner {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    box-shadow: 0 2px 6px rgba(217,91,43,.2);
}

.logo-text {
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -.03em;
}

.logo-text em {
    font-style: normal;
    color: var(--accent);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-live {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .72rem;
    font-weight: 600;
    color: var(--green);
    background: var(--green-light);
    padding: 5px 10px;
    border-radius: 20px;
    letter-spacing: .01em;
}

.badge-live-dot {
    width: 6px;
    height: 6px;
    background: var(--green);
    border-radius: 50%;
    animation: blink 2s infinite;
}

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

/* ── HERO ───────────────────────────── */
.hero {
    padding: 48px 24px 36px;
    text-align: center;
}

.hero h1 {
    font-size: clamp(1.6rem, 4.5vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.2;
    margin-bottom: 10px;
    color: var(--text);
}

.hero h1 .hl {
    color: var(--accent);
}

.hero-sub {
    color: var(--text-secondary);
    font-size: .95rem;
    max-width: 440px;
    margin: 0 auto;
}

/* ── SEARCH BOX ─────────────────────── */
.search-box {
    max-width: 600px;
    margin: 32px auto 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.search-label {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: block;
}

/* Fuel pills */
.fuel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 20px;
}

.fuel-pill {
    padding: 10px 6px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s ease;
    text-align: center;
}

.fuel-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.fuel-pill.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

/* Controls row */
.search-sep {
    height: 1px;
    background: var(--border);
    margin: 0 0 18px;
}

.controls-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.select-wrap {
    position: relative;
    flex: 1;
}

.select-wrap select {
    width: 100%;
    height: 100%;
    padding: 12px 36px 12px 14px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font);
    font-size: .88rem;
    font-weight: 600;
    appearance: none;
    cursor: pointer;
    transition: border-color .15s;
}

.select-wrap select:focus {
    outline: none;
    border-color: var(--accent);
}

.select-wrap::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-muted);
    pointer-events: none;
}

.btn-search {
    flex: 2;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent);
    color: #fff;
    font-family: var(--font);
    font-size: .92rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all .15s ease;
    box-shadow: 0 2px 8px rgba(217,91,43,.2);
}

.btn-search:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 14px rgba(217,91,43,.3);
}

.btn-search:active { transform: scale(.98); }

.btn-search:disabled {
    opacity: .5;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

.btn-search svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Location status */
.loc-status {
    text-align: center;
    margin-top: 14px;
    font-size: .78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.loc-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
}

.loc-dot.active {
    background: var(--green);
}

/* ── RESULTS SECTION ────────────────── */
.results-section {
    max-width: 660px;
    margin: 0 auto;
    padding: 0 24px 60px;
    width: 100%;
}

.results-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-top: 4px;
}

.results-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.results-count {
    font-size: .78rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Savings banner */
.savings-banner {
    background: var(--green-light);
    border: 1px solid rgba(26,127,90,.15);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .84rem;
    color: var(--green-dark);
    font-weight: 600;
}

.savings-banner strong {
    font-weight: 800;
}

/* ── STATION CARD ───────────────────── */
.station-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 8px;
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 14px;
    align-items: center;
    transition: border-color .15s, box-shadow .15s;
    box-shadow: var(--shadow-sm);
    animation: slide-up .35s ease both;
}

.station-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow);
}

@keyframes slide-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Stagger animations */
.station-card:nth-child(2) { animation-delay: .04s; }
.station-card:nth-child(3) { animation-delay: .08s; }
.station-card:nth-child(4) { animation-delay: .12s; }
.station-card:nth-child(5) { animation-delay: .16s; }
.station-card:nth-child(6) { animation-delay: .20s; }

/* Rank badge */
.rank {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: .85rem;
    background: var(--surface-alt);
    color: var(--text-muted);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.rank.gold {
    background: #fef3c7;
    color: var(--gold);
    border-color: #fcd34d;
}

.rank.silver {
    background: #f4f4f5;
    color: var(--silver);
    border-color: #d4d4d8;
}

.rank.bronze {
    background: #fef0e4;
    color: var(--bronze);
    border-color: #f5c99a;
}

/* Station info */
.station-info {
    min-width: 0;
}

.station-brand {
    font-weight: 800;
    font-size: .9rem;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.station-address {
    color: var(--text-secondary);
    font-size: .78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.station-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: .7rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface-alt);
    padding: 2px 7px;
    border-radius: 4px;
}

.tag svg {
    width: 11px;
    height: 11px;
    fill: currentColor;
}

.tag-24h {
    color: var(--purple);
    background: var(--purple-light);
}

/* Price & action */
.station-right {
    text-align: right;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.station-price {
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--green);
    letter-spacing: -.02em;
    line-height: 1;
}

.station-price .unit {
    font-size: .65rem;
    font-weight: 600;
    color: var(--text-muted);
}

.btn-nav {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 6px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: .7rem;
    font-weight: 700;
    text-decoration: none;
    transition: all .15s;
}

.btn-nav:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.btn-nav svg {
    width: 11px;
    height: 11px;
    fill: currentColor;
}

/* ── LOADING / STATES ───────────────── */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    margin: 0 auto 14px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-box {
    text-align: center;
    padding: 36px 24px;
    background: var(--red-light);
    border: 1px solid rgba(197,48,48,.12);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.error-box p {
    color: var(--red);
    font-weight: 600;
    font-size: .9rem;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: .9rem;
}

/* Skeleton */
.skeleton-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 8px;
    display: flex;
    gap: 14px;
    align-items: center;
}

.skel {
    background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 50%, var(--surface-alt) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── FOOTER ─────────────────────────── */
.footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: var(--surface-alt);
    padding: 24px;
    text-align: center;
}

.footer p {
    color: var(--text-muted);
    font-size: .75rem;
    line-height: 1.7;
}

.footer a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    color: var(--accent);
}

/* ── RESPONSIVE ─────────────────────── */
@media (min-width: 480px) {
    .fuel-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 600px) {
    .hero { padding: 32px 16px 24px; }

    .search-box {
        margin-left: -8px;
        margin-right: -8px;
        padding: 18px 16px;
    }

    .controls-row { flex-direction: column; }

    .station-card {
        grid-template-columns: 38px 1fr;
        gap: 10px;
        padding: 14px;
    }

    .rank {
        width: 38px;
        height: 38px;
        font-size: .8rem;
    }

    .station-right {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding-top: 10px;
        border-top: 1px solid var(--border);
    }

    .results-section { padding: 0 16px 40px; }
}

.hidden { display: none !important; }
