/* ======================================
   AutoMax — Modern Car Dealership Theme
   ====================================== */

/* ---------- RESET & BASE ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Core palette */
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-card: #1a2035;
    --bg-card-hover: #222b45;
    --surface: #1e293b;

    /* Accent */
    --red: #dc2626;
    --red-hover: #ef4444;
    --red-dark: #991b1b;
    --red-glow: rgba(220, 38, 38, 0.3);

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Misc */
    --border: rgba(255, 255, 255, 0.06);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul {
    list-style: none;
}

button {
    cursor: pointer;
    font-family: inherit;
}


/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--red);
    border-radius: 4px;
}


/* ---------- CONTAINER ---------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}


/* ========== HEADER ========== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 16px 0;
    transition: var(--transition);
    background: transparent;
}

.header.scrolled {
    background: rgba(11, 15, 25, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}

.logo img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.logo span.red {
    color: var(--red);
}

.nav {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 8px 0;
    position: relative;
    transition: var(--transition);
}

.nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--red);
    transition: var(--transition);
}

.nav a:hover,
.nav a.active {
    color: var(--text-primary);
}

.nav a:hover::after,
.nav a.active::after {
    width: 100%;
}

.nav-tg {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--red);
    color: #fff !important;
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.05rem;
    transition: var(--transition);
    box-shadow: 0 4px 20px var(--red-glow);
    margin: 0 32px;
}

.nav-tg svg {
    width: 22px;
    height: 22px;
}

.nav-tg:hover {
    background: var(--red-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px var(--red-glow);
}

.nav-tg::after {
    display: none !important;
}

/* Language toggle */
.lang-toggle {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50px;
    padding: 3px;
    margin: 0 8px;
}

.lang-btn {
    padding: 6px 14px !important;
    border-radius: 50px;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    transition: var(--transition);
    cursor: pointer;
    letter-spacing: 0.05em;
}

.lang-btn:hover {
    color: var(--text-primary) !important;
}

.lang-btn.active {
    background: var(--red) !important;
    color: #fff !important;
}

.lang-btn::after {
    display: none !important;
}

/* Mobile hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition);
    border-radius: 2px;
}


/* ========== HERO ========== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.3);
}

.hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
            rgba(11, 15, 25, 0.4) 0%,
            rgba(11, 15, 25, 0.6) 50%,
            rgba(11, 15, 25, 1) 100%);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    padding: 0 24px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: var(--red);
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 24px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hero h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 20px;
    letter-spacing: -0.03em;
}

.hero h1 .highlight {
    color: var(--red);
    position: relative;
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 36px;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}


/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    transition: var(--transition);
    text-transform: none;
    letter-spacing: 0;
}

.btn-primary {
    background: var(--red);
    color: #fff;
    box-shadow: 0 4px 20px var(--red-glow);
}

.btn-primary:hover {
    background: var(--red-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px var(--red-glow);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-outline:hover {
    border-color: var(--red);
    color: var(--red);
    transform: translateY(-2px);
}

.btn-lg {
    padding: 18px 48px;
    font-size: 1.1rem;
}


/* ========== SECTION COMMON ========== */
.section {
    padding: 100px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header .label {
    display: inline-block;
    color: var(--red);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.section-header h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.section-header p {
    color: var(--text-secondary);
    max-width: 540px;
    margin: 0 auto;
    font-size: 1.05rem;
}


/* ========== TOP PICKS / CARS GRID ========== */
.cars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 28px;
}

.car-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
}

.car-card:hover {
    transform: translateY(-6px);
    border-color: rgba(220, 38, 38, 0.3);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(220, 38, 38, 0.15);
}

.car-card .card-img {
    width: 100%;
    height: 220px;
    overflow: hidden;
    position: relative;
}

.car-card .card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.car-card:hover .card-img img {
    transform: scale(1.05);
}

.car-card .card-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    background: var(--red);
    color: #fff;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    z-index: 2;
}

.car-card .card-body {
    padding: 20px 24px 24px;
}

.car-card .card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.car-card .card-specs {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.car-card .spec {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.car-card .spec svg {
    width: 16px;
    height: 16px;
    fill: var(--text-muted);
}

.car-card .card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.car-card .price {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--red);
}

.car-card .btn-details {
    padding: 8px 20px;
    background: rgba(220, 38, 38, 0.1);
    color: var(--red);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.car-card .btn-details:hover {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}


/* ========== CTA SECTION ========== */
.cta-section {
    text-align: center;
    padding: 80px 0;
}

.cta-section .btn-lg {
    margin: 0 auto;
}


/* ========== SEARCH SECTION ========== */
.search-section {
    padding: 60px 0;
    text-align: center;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.08) 0%, rgba(30, 41, 59, 0.6) 50%, rgba(220, 38, 38, 0.08) 100%);
    border-top: 1px solid rgba(220, 38, 38, 0.15);
    border-bottom: 1px solid rgba(220, 38, 38, 0.15);
}

.search-content {
    max-width: 620px;
    margin: 0 auto;
}

.search-content h2 {
    font-size: clamp(1.5rem, 3.5vw, 2.2rem);
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.search-content p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 28px;
}


/* ========== STATS ROW ========== */
.stats-row {
    display: flex;
    justify-content: center;
    gap: 80px;
    padding: 40px 0;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-item .number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--red);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-item .label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}


/* ========== FOOTER ========== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 60px 0 30px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 48px;
}

.footer-brand .logo {
    margin-bottom: 16px;
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
    max-width: 300px;
}

.footer h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.footer ul li {
    margin-bottom: 10px;
}

.footer ul a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer ul a:hover {
    color: var(--red);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-socials {
    display: flex;
    gap: 12px;
}

.footer-socials a {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.footer-socials a:hover {
    background: var(--red);
    transform: translateY(-2px);
}

.footer-socials svg {
    width: 18px;
    height: 18px;
    fill: var(--text-secondary);
}

.footer-socials a:hover svg {
    fill: #fff;
}


/* ========== CATALOG PAGE ========== */
.page-hero {
    padding: 140px 0 60px;
    text-align: center;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.page-hero h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    margin-bottom: 12px;
}

.page-hero p {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

#cars-count,
#archive-count {
    color: var(--red);
    font-weight: 700;
}

/* Archive sold badge */
.sold-badge {
    background: #16a34a !important;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.archive-card {
    opacity: 0.92;
}

.archive-card:hover {
    opacity: 1;
}

/* Sold spec in modal */
.sold-spec .val {
    color: #16a34a !important;
}

.sold-spec .lbl {
    color: #16a34a !important;
}

.catalog-section {
    padding: 40px 0 100px;
}

/* Loading spinner */
.loader {
    display: flex;
    justify-content: center;
    padding: 60px 0;
}

.loader .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* ========== CAR MODAL ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 720px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(30px) scale(0.95);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--red);
}

.modal-close svg {
    width: 18px;
    height: 18px;
    fill: var(--text-secondary);
}

.modal-close:hover svg {
    fill: #fff;
}

.modal-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    padding: 24px;
}

.modal-gallery img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.modal-gallery img:hover {
    border-color: var(--red);
    transform: scale(1.03);
}

.modal-gallery img.active-thumb {
    border-color: var(--red);
}

.modal-main-photo {
    padding: 0 24px;
    margin-bottom: 20px;
}

.modal-main-photo img {
    width: 100%;
    height: 360px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.modal-body {
    padding: 0 24px 24px;
}

.modal-body .specs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.modal-body .spec-box {
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
}

.modal-body .spec-box .val {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.modal-body .spec-box .lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

.modal-body .description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.8;
    white-space: pre-line;
}

.modal-body .modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}


/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stats-row {
        gap: 40px;
    }

    .nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--bg-secondary);
        flex-direction: column;
        align-items: flex-start;
        padding: 80px 32px 32px;
        gap: 16px;
        transition: var(--transition);
        border-left: 1px solid var(--border);
        z-index: 999;
    }

    .nav.open {
        right: 0;
    }

    .hamburger {
        display: flex;
        z-index: 1001;
    }

    .modal-body .specs-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .cars-grid {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .stats-row {
        gap: 24px;
    }

    .stat-item .number {
        font-size: 2rem;
    }

    .modal-body .specs-grid {
        grid-template-columns: 1fr;
    }
}