/* ──── Кирилл PRO Авто — Design System ──── */
:root {
    --bg: #0a0a0a;
    --card: #141414;
    --input: #1a1a1a;
    --primary: #d4842a;
    --primary-hover: #e8963a;
    --primary-glow: rgba(212,132,42,0.45);
    --secondary: #6b7a3a;
    --text: #f0e6d0;
    --text-muted: #8a8070;
    --border: #2a2520;
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #ef4444;
    --info: #60a5fa;
    --font: 'DM Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body, #app {
    height: 100%;
    margin: 0;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ──── Scrollbar ──── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--text-muted);
    }

/* ──── Layout ──── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: var(--card);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
    z-index: 50;
}

.sidebar-logo {
    padding: 0 20px 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary)cc);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 4px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
    background: transparent;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    font-family: var(--font);
    text-align: left;
}

    .nav-item:hover {
        color: var(--text);
        background: rgba(212,132,42,0.1);
    }

    .nav-item.active {
        font-weight: 600;
        color: #fff;
        background: rgba(212,132,42,0.18);
        border-left-color: var(--primary);
        box-shadow: inset 0 0 12px rgba(212,132,42,0.08);
    }

    .nav-item .badge {
        margin-left: auto;
        background: var(--danger);
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        padding: 2px 6px;
        border-radius: 10px;
    }

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.main-content {
    flex: 1;
    padding: 24px 32px;
    overflow-y: auto;
}

/* ──── Cards ──── */
.card {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
}

/* ──── Buttons ──── */
.btn {
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: var(--card);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-family: var(--font);
}

    .btn:hover {
        border-color: var(--primary);
        color: #fff;
        background: linear-gradient(135deg, var(--primary), #c0751f);
        box-shadow: 0 2px 16px var(--primary-glow);
    }

    .btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #c0751f);
    color: #fff;
    border: none;
    box-shadow: 0 2px 16px var(--primary-glow), 0 0 30px rgba(212,132,42,0.15);
}

    .btn-primary:hover {
        background: linear-gradient(135deg, var(--primary-hover), var(--primary));
        box-shadow: 0 4px 24px var(--primary-glow), 0 0 40px rgba(212,132,42,0.25);
    }

.btn-danger {
    background: var(--danger);
    color: #fff;
    border: none;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 11px;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* ──── Active/Selected Tab Buttons (country tabs, mode toggle, etc.) ──── */
.btn.active,
.btn[class*="btn-primary"] {
    box-shadow: 0 2px 16px var(--primary-glow), 0 0 30px rgba(212,132,42,0.15);
}

/* ──── Inputs ──── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.form-hint {
    font-size: 10px;
    color: var(--text-muted);
}

.form-input, .form-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--input);
    color: var(--text);
    font-size: 13px;
    outline: none;
    font-family: var(--font);
    transition: border-color 0.2s;
}

    .form-input:focus, .form-select:focus {
        border-color: var(--primary);
        box-shadow: 0 0 8px rgba(212,132,42,0.2);
    }

    .form-input::placeholder {
        color: var(--text-muted);
    }

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8070' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.input-with-suffix {
    position: relative;
}

.input-suffix {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--text-muted);
    pointer-events: none;
}

/* ──── Badges ──── */
.badge-status {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ──── Steps ──── */
.steps {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.step {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    transition: all 0.3s;
}

    .step.active, .step.done {
        background: rgba(212,132,42,0.18);
        border-color: rgba(212,132,42,0.5);
        box-shadow: 0 0 12px rgba(212,132,42,0.15);
    }

.step-number {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border);
    color: var(--text-muted);
}

.step.active .step-number, .step.done .step-number {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 8px var(--primary-glow);
}

.step-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.step.active .step-label, .step.done .step-label {
    color: var(--text);
    font-weight: 600;
}

/* ──── Stat Boxes ──── */
.stat-box {
    flex: 1;
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--input);
    border: 1px solid var(--border);
    text-align: center;
}

.stat-box-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-box-value {
    font-size: 18px;
    font-weight: 700;
}

.stat-box-sub {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ──── Car Card ──── */
.car-card {
    background: var(--input);
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

    .car-card:hover {
        border-color: rgba(212,132,42,0.5);
    }

    .car-card.selected {
        border-color: var(--primary);
        box-shadow: 0 0 24px rgba(212,132,42,0.2), 0 0 48px rgba(212,132,42,0.08);
    }

.car-card-image {
    position: relative;
    height: 170px;
    overflow: hidden;
    background: #111;
}

    .car-card-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.car-card-body {
    padding: 12px 14px;
}

/* ──── Result Breakdown ──── */
.breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 12px;
    border-radius: 6px;
}

    .breakdown-row:nth-child(odd) {
        background: var(--input);
    }

.breakdown-label {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.breakdown-value {
    font-size: 12px;
    font-weight: 600;
}

.breakdown-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    margin: 14px 0 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.total-box {
    margin-top: 18px;
    padding: 16px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(212,132,42,0.18), rgba(212,132,42,0.05));
    border: 1px solid rgba(212,132,42,0.35);
    box-shadow: 0 0 20px rgba(212,132,42,0.1);
}

.total-label {
    font-size: 15px;
    font-weight: 600;
}

.total-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
}

/* ──── KP Preview ──── */
.kp-preview {
    background: #fff;
    color: #222;
    border-radius: 8px;
    padding: 20px;
    font-family: Georgia, serif;
    font-size: 12px;
    line-height: 1.6;
}

.kp-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid #d4842a;
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.kp-brand {
    font-size: 16px;
    font-weight: 700;
    color: #d4842a;
}

.kp-total-line {
    display: flex;
    justify-content: space-between;
    padding: 6px 0 0;
    border-top: 2px solid #d4842a;
    margin-top: 8px;
    font-weight: 700;
    font-size: 14px;
    color: #d4842a;
}

/* ──── Loading ──── */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    flex-direction: column;
    gap: 12px;
}

.loading-text {
    font-size: 13px;
    color: var(--text-muted);
}

/* ──── Grid helpers ──── */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.gap-4 {
    gap: 4px;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.gap-16 {
    gap: 16px;
}

.gap-20 {
    gap: 20px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-24 {
    margin-bottom: 24px;
}

/* ──── Mobile ──── */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        padding: 16px;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .steps {
        flex-wrap: wrap;
    }

    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--card);
        border-top: 1px solid var(--border);
        z-index: 100;
        padding: 8px 0 max(8px, env(safe-area-inset-bottom));
        justify-content: space-around;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 4px 8px;
        border: none;
        background: none;
        color: var(--text-muted);
        font-size: 10px;
        cursor: pointer;
        font-family: var(--font);
    }

        .mobile-nav-item.active {
            color: var(--primary);
            text-shadow: 0 0 8px rgba(212,132,42,0.4);
        }

        .mobile-nav-item .nav-icon {
            font-size: 20px;
        }

    .main-content {
        padding-bottom: 80px;
    }
}

@media (min-width: 769px) {
    .mobile-nav {
        display: none;
    }
}

/* ──── Transitions ──── */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ──── Modal ──── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal {
    width: 500px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
}
