/* Базовая стилистика */
:root {
    --bg-main: #0b1020;
    --bg-elevated: #13182a;
    --bg-card: #181f33;
    --accent: #4f8bff;
    --accent-soft: rgba(79, 139, 255, 0.12);
    --text-main: #f7f9ff;
    --text-muted: #9aa3c5;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --radius-lg: 16px;
    --radius-md: 10px;
    --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.45);
}

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

body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(circle at 0% 0%, rgba(79, 139, 255, 0.35), transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(114, 205, 255, 0.25), transparent 55%),
        linear-gradient(145deg, #050713, #050712 50%, #050515 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Шапка */
.site-header {
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(22px);
    background: linear-gradient(120deg, rgba(11, 16, 32, 0.96), rgba(11, 16, 32, 0.9));
    /* position: sticky; */
    top: 0;
    z-index: 50;
}

.header-inner {
    display: flex;
    position: relative;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.logo-image {
    margin-left: 20px;
    height: 40px;
    width: auto;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.logo-mark {
    padding: 6px 10px;
    border-radius: 999px;
    background: radial-gradient(circle at 0 0, #4f8bff, #2f5ed0);
    color: #fff;
    font-size: 11px;
}

.logo-text {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.main-nav {
    display: flex;
    gap: 12px;
    font-size: 14px;
}

.nav-link {
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--text-muted);
}

.nav-link-active,
.nav-link:hover {
    background: rgba(79, 139, 255, 0.16);
    color: var(--text-main);
}

/* Основной контент */
.site-main {
    padding: 24px 0 40px;
}

.page-header {
    margin-bottom: 18px;
}

.page-title {
    margin: 0 0 4px;
    font-size: 26px;
    letter-spacing: 0.02em;
}

.page-subtitle {
    margin: 0;
    font-size: 14px;
    color: var(--text-muted);
}

/* Фильтры */
.filters {
    margin-bottom: 18px;
}

.filters-form {
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(24, 31, 51, 0.96), rgba(20, 28, 46, 0.98));
    border: 1px solid var(--border-subtle);
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.field {
    flex: 1 1 180px;
    min-width: 0;
}

.field-label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.field-input {
    width: 100%;
    padding: 9px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(6, 8, 18, 0.9);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
}

.field-input:focus {
    border-color: rgba(79, 139, 255, 0.75);
    box-shadow: 0 0 0 1px rgba(79, 139, 255, 0.4);
}

.field-submit {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 9px 18px;
    border: none;
    font-size: 14px;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, #4f8bff, #6ac9ff);
    color: #fff;
    box-shadow: 0 12px 30px rgba(79, 139, 255, 0.4);
}

.btn-primary:hover {
    filter: brightness(1.08);
}

/* Сетка карточек */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.car-card {
    border-radius: var(--radius-lg);
    background: radial-gradient(circle at 0 0, rgba(79, 139, 255, 0.22), transparent 55%),
        linear-gradient(145deg, #111629, #141a30);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.car-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.car-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    border-color: rgba(79, 139, 255, 0.6);
}

.car-card-image-wrap {
    position: relative;
    padding-top: 60%;
    overflow: hidden;
}

.car-card-image,
.car-card-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.car-card-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 0 0, rgba(255, 255, 255, 0.18), transparent 55%);
    color: var(--text-muted);
    font-size: 13px;
}

.car-card-badge {
    position: absolute;
    left: 10px;
    top: 10px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.78);
    border: 1px solid rgba(107, 214, 156, 0.85);
    color: #7de0b0;
}

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

.car-card-title {
    margin: 0 0 3px;
    font-size: 16px;
}

.car-card-price {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 6px;
}

.car-card-specs {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

.spec-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
}

.spec-row dt {
    opacity: 0.85;
}

.spec-row dd {
    margin: 0;
    text-align: right;
}

/* Детальная страница */
.back-link {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.back-link:hover {
    color: var(--text-main);
}

.car-detail {
    border-radius: 20px;
    background: linear-gradient(145deg, #111629, #141a30);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-soft);
    padding: 18px 18px 20px;
}

.car-detail-main {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2.3fr);
    gap: 18px;
}

.car-detail-image-wrap {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    background: #050713;
}

.car-detail-image,
.car-detail-image-placeholder {
    width: 100%;
    height: 100%;
    max-height: 420px;
    object-fit: cover;
}

.car-detail-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.car-detail-badge {
    position: absolute;
    left: 14px;
    top: 14px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.78);
    border: 1px solid rgba(107, 214, 156, 0.85);
    color: #7de0b0;
}

.car-detail-info {
    display: flex;
    flex-direction: column;
}

.car-detail-title {
    margin: 0 0 6px;
    font-size: 22px;
}

.car-detail-price {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}

.car-detail-specs {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.car-detail-source {
    margin-top: auto;
    font-size: 13px;
    color: var(--text-muted);
}

.car-detail-source a {
    color: var(--accent);
}

.car-detail-source a:hover {
    text-decoration: underline;
}

.car-detail-gallery {
    margin-top: 18px;
}

.section-title {
    margin: 0 0 8px;
    font-size: 16px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.gallery-item {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: #050713;
    padding: 0;
    cursor: pointer;
}

.gallery-image {
    width: 100%;
    height: 110px;
    object-fit: cover;
}

.car-detail-note {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.ad-benefits {
    margin: 0 0 8px;
    padding-left: 18px;
}

.ad-benefits li {
    margin: 2px 0;
}

.ad-note {
    margin: 2px 0;
}

.ad-note a {
    color: var(--accent);
}

.ad-note a:hover {
    text-decoration: underline;
}

.ad-code span {
    color: var(--text-main);
    font-weight: 600;
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease-out;
    z-index: 1000;
}

.lightbox-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-inner {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.9);
}

.lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(11, 16, 32, 0.95);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.lightbox-close:hover {
    background: rgba(20, 28, 46, 1);
}

/* Пустое состояние */
.empty-state {
    margin-top: 24px;
}

.empty-card {
    padding: 20px 18px;
    border-radius: 18px;
    background: radial-gradient(circle at 0 0, rgba(79, 139, 255, 0.18), transparent 55%),
        linear-gradient(145deg, #111629, #141a30);
    border: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
}

.empty-card h2 {
    margin: 0 0 6px;
}

.empty-card p {
    margin: 0;
    color: var(--text-muted);
}

/* Футер */
.site-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 12px 0 14px;
    font-size: 12px;
    color: var(--text-muted);
}

.footer-inner {
    display: flex;
    justify-content: center;
}

/* Адаптив */
@media (max-width: 820px) {
    .car-detail-main {
        grid-template-columns: 1fr;
    }

    .car-detail-image,
    .car-detail-image-placeholder {
        max-height: 320px;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 14px;
    }

    .header-inner {
        padding: 10px 0;
    }

    .page-title {
        font-size: 22px;
    }

    .filters-form {
        padding: 12px 12px;
    }

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

    .field {
        flex: 1 1 100%;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .car-card {
        border-radius: 16px;
    }

    .car-detail {
        padding: 14px 12px 16px;
        border-radius: 16px;
    }

    .car-detail-title {
        font-size: 20px;
    }

    .car-detail-price {
        font-size: 18px;
    }

    .gallery-image {
        height: 140px;
    }

    .car-detail-note {
        font-size: 12px;
    }

    .field-submit {
        width: 100%;
    }

    .btn-primary {
        width: 100%;
    }
}