/* styles.css — Калкулатор за данок при увоз на возила
   Dark-mode-first, со автоматска светла варијанта преку prefers-color-scheme. */

:root {
    --bg: #0B1120;
    --bg-elev: #131C2E;
    --surface: #1E293B;
    --surface-2: #243349;
    --border: #2C3A52;
    --text: #E2E8F0;
    --muted: #94A3B8;
    --accent: #34D399;
    --accent-strong: #10B981;
    --accent-contrast: #042F22;
    --danger: #F87171;
    --warn: #FBBF24;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --ring: 0 0 0 3px rgba(52, 211, 153, 0.35);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #F1F5F9;
        --bg-elev: #FFFFFF;
        --surface: #FFFFFF;
        --surface-2: #F8FAFC;
        --border: #E2E8F0;
        --text: #0F172A;
        --muted: #64748B;
        --accent: #10B981;
        --accent-strong: #059669;
        --accent-contrast: #FFFFFF;
        --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: radial-gradient(1200px 600px at 50% -10%, var(--bg-elev), var(--bg)) fixed;
    color: var(--text);
    font-family: var(--font);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.page {
    max-width: 720px;
    margin: 0 auto;
    padding: clamp(16px, 4vw, 40px) clamp(14px, 4vw, 24px) 64px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Header ─────────────────────────────────────────────────────────── */
.page__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

h1 {
    font-size: clamp(1.5rem, 4.5vw, 2.1rem);
    line-height: 1.15;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}

.subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
}

.rate-badge {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    box-shadow: var(--shadow);
}

.rate-badge__pair { font-size: 0.7rem; color: var(--muted); letter-spacing: 0.08em; }
.rate-badge__value { font-size: 1.4rem; font-weight: 700; color: var(--accent); }
.rate-badge__label { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Cards ──────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(18px, 4vw, 28px);
    box-shadow: var(--shadow);
}

.card__title { margin: 0 0 18px; font-size: 1.15rem; }
.card__subtitle { margin: 0 0 12px; font-size: 1.05rem; }

/* ── Form ───────────────────────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field > label, .field legend {
    display: block;
    margin-bottom: 7px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
}

input[type="text"], select {
    width: 100%;
    padding: 12px 14px;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]::placeholder { color: var(--muted); }

input[type="text"]:focus, select:focus, .info:focus, .crypto__item:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
}

select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                      linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 20px) center, calc(100% - 15px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 38px;
    cursor: pointer;
}

.info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 4px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.72rem;
    cursor: help;
}

/* Fuel chips */
.fuel { border: 0; padding: 0; margin: 0 0 18px; }
.fuel__options { display: flex; gap: 12px; }

.chip {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.chip input { accent-color: var(--accent); width: 18px; height: 18px; cursor: pointer; }
.chip:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); }
.chip:hover { border-color: var(--accent); }

.error {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--danger) 16%, transparent);
    border: 1px solid var(--danger);
    color: var(--danger);
    font-size: 0.9rem;
}

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    width: 100%;
    padding: 14px 20px;
    border: 0;
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn--primary { background: var(--accent); color: var(--accent-contrast); }
.btn--primary:hover { background: var(--accent-strong); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(16, 185, 129, 0.3); }
.btn--primary:active { transform: translateY(0); }

/* ── Result ─────────────────────────────────────────────────────────── */
.result[hidden] { display: none; }

@keyframes result-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.result--enter { animation: result-in 0.35s ease both; }

.headline {
    text-align: center;
    padding: 22px;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
    border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
    margin-bottom: 24px;
}
.headline__label { display: block; color: var(--muted); font-size: 0.92rem; }
.headline__amount { display: block; font-size: clamp(2.1rem, 7vw, 2.8rem); font-weight: 800; color: var(--accent); margin: 6px 0; letter-spacing: -0.02em; }
.headline__note { display: block; color: var(--muted); font-size: 0.85rem; }

.breakdown { list-style: none; margin: 0 0 18px; padding: 0; }
.breakdown li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 11px 2px;
    border-bottom: 1px solid var(--border);
}
.breakdown li span { color: var(--muted); }
.breakdown li strong { text-align: right; }
.breakdown__total { font-size: 1.1rem; border-bottom: 0 !important; }
.breakdown__total strong { color: var(--accent); }

.formula {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 16px;
}
.formula summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
.formula__eq { text-align: center; font-size: 1.05rem; }
.no-bullets { list-style: none; padding: 0; margin: 0 0 12px; }
.no-bullets li { color: var(--muted); margin: 8px 0; font-size: 0.92rem; }
.no-bullets strong { color: var(--text); }

/* ── Donation ───────────────────────────────────────────────────────── */
.crypto { display: flex; flex-direction: column; gap: 12px; }
.crypto__item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 4px 12px;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s ease, transform 0.12s ease;
}
.crypto__item:hover { border-color: var(--accent); transform: translateY(-1px); }
.crypto__label { font-weight: 600; font-size: 0.85rem; }
.crypto__item code { grid-column: 1; font-size: 0.8rem; color: var(--muted); word-break: break-all; }
.crypto__copy { grid-row: 1 / span 2; grid-column: 2; font-size: 1.1rem; }

/* ── Legal / footer ─────────────────────────────────────────────────── */
.legal { text-align: center; }
.muted { color: var(--muted); font-size: 0.88rem; margin: 6px 0; }
.legal__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin: 8px 0 16px; }
.legal__links a { color: var(--accent); text-decoration: none; font-size: 0.85rem; }
.legal__links a:hover { text-decoration: underline; }
.watermark a { color: var(--muted); text-decoration: none; font-size: 0.8rem; }
.watermark a:hover { color: var(--text); }

/* ── Toast ──────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: var(--accent-contrast);
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    z-index: 10;
}
.toast[hidden] { display: none; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .page__header { flex-direction: column; }
    .rate-badge { flex-direction: row; gap: 8px; align-items: baseline; }
    .fuel__options { flex-direction: column; }
}
