:root {
    --bg: #0d0d0d;
    --bg2: #141414;
    --card: #1a1a1a;
    --card-hover: #212121;
    --border: #2a2a2a;
    --red: #e63946;
    --red-dark: #c1121f;
    --text: #f0f0f0;
    --text-muted: #888;
    --dot-active: #e63946;
    --dot-inactive: #333;
    --accent: #e63946;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
}

/* ── NAVBAR ─────────────────────────────────────────── */
.navbar {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.navbar-brand span { color: var(--red); }

.navbar-brand svg { width: 28px; height: 28px; fill: var(--red); }

.navbar-links { display: flex; align-items: center; gap: 1rem; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all .15s ease;
}

.btn-primary {
    background: var(--red);
    color: #fff;
}
.btn-primary:hover { background: var(--red-dark); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }

.btn-danger { background: #7f1d1d; color: #fca5a5; }
.btn-danger:hover { background: #991b1b; }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }

/* ── HERO ────────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, #1a0a0a 0%, #0d0d0d 60%);
    padding: 2.5rem 2rem 1.5rem;
    text-align: center;
}

.hero h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: .4rem; }
.hero h1 span { color: var(--red); }
.hero p { color: var(--text-muted); font-size: 1rem; }

/* ── FILTER PANEL ────────────────────────────────────── */
.filter-wrap {
    background: var(--bg2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 2rem;
}

.filter-panel { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.1rem; }

/* Search row */
.filter-search-row { width: 100%; }

.filter-input-icon {
    position: relative;
    width: 100%;
}
.fi-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--red);
    pointer-events: none;
}
.fi-input {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 16px 12px 44px;
    border-radius: 10px;
    font-size: .95rem;
    outline: none;
    transition: border-color .15s;
    font-family: inherit;
}
.fi-input:focus { border-color: var(--red); }
.fi-input::placeholder { color: var(--text-muted); }

/* 2-col row */
.filter-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* 4-col row */
.filter-row-4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 1rem;
}

.filter-group { display: flex; flex-direction: column; gap: .4rem; }

.filter-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--text-muted);
}

/* Custom select */
.filter-select-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color .15s;
}
.filter-select-wrap:focus-within { border-color: var(--red); }

.fs-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--red);
    pointer-events: none;
    flex-shrink: 0;
}
.fs-chevron {
    position: absolute;
    right: 12px;
    width: 16px;
    height: 16px;
    color: var(--red);
    pointer-events: none;
}
.fs-select {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text);
    padding: 12px 36px 12px 38px;
    font-size: .9rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    font-family: inherit;
}
.fs-select option { background: var(--card); }

/* Affix input (price / weight) */
.filter-input-affix {
    display: flex;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color .15s;
}
.filter-input-affix:focus-within { border-color: var(--red); }

.affix-pre {
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: .85rem;
    font-weight: 700;
    flex-shrink: 0;
    color: var(--text-muted);
}
.affix-pre.red { color: var(--red); }

.affix-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    padding: 11px 8px;
    font-size: .9rem;
    outline: none;
    min-width: 0;
    font-family: inherit;
}
.affix-input::placeholder { color: var(--text-muted); }
.affix-input::-webkit-outer-spin-button,
.affix-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.affix-suf {
    padding: 0 12px;
    font-size: .78rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Action buttons */
.filter-actions {
    display: flex;
    gap: .75rem;
    justify-content: center;
    padding-top: .25rem;
}

.btn-sort {
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: 99px;
    padding: 10px 28px;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background .15s;
    font-family: inherit;
}
.btn-sort:hover { background: var(--red-dark); }

.btn-reset {
    background: transparent;
    color: var(--text);
    border: 1px solid #2e6b60;
    border-radius: 99px;
    padding: 10px 28px;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all .15s;
    color: #4ecca3;
}
.btn-reset:hover { background: rgba(78,204,163,.1); border-color: #4ecca3; }

/* Results header */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
    gap: .5rem;
}
.results-count { color: var(--text-muted); font-size: .875rem; }

/* Responsive */
@media(max-width: 900px) {
    .filter-row-4 { grid-template-columns: 1fr 1fr; }
}
@media(max-width: 600px) {
    .filter-wrap { padding: 1.2rem 1rem; }
    .filter-row-2 { grid-template-columns: 1fr; }
    .filter-row-4 { grid-template-columns: 1fr 1fr; }
    .filter-actions { flex-direction: column; }
    .btn-sort, .btn-reset { justify-content: center; }
}

/* ── CATALOG GRID ────────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 2rem; }

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.vehicle-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.vehicle-card:hover {
    transform: translateY(-4px);
    border-color: var(--red);
    box-shadow: 0 8px 32px rgba(230, 57, 70, .18);
}

.card-img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: #111;
    display: block;
}
.card-img-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 3rem;
}

.card-body { padding: 1rem; }

.card-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: .3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-price {
    color: var(--red);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: .75rem;
}

.card-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: .75rem;
}
.card-meta span { display: flex; align-items: center; gap: 4px; }

.card-badge {
    display: inline-block;
    background: rgba(230, 57, 70, .15);
    color: var(--red);
    font-size: .72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    border: 1px solid rgba(230, 57, 70, .3);
    margin-bottom: .5rem;
}

.card-footer {
    display: flex;
    justify-content: flex-end;
    padding: .6rem 1rem;
    border-top: 1px solid var(--border);
}
.card-footer .btn { font-size: .78rem; }

/* ── DOTS ────────────────────────────────────────────── */
.dots {
    display: flex;
    gap: 4px;
    align-items: center;
}
.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--dot-inactive);
}
.dot.active { background: var(--dot-active); }

/* ── MODAL ───────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    padding: 1rem;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 18px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(.96) translateY(12px);
    transition: transform .2s ease;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255,255,255,.08);
    border: none;
    color: var(--text);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    z-index: 2;
}
.modal-close:hover { background: var(--red); }

.modal-img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 18px 18px 0 0;
    background: #111;
    display: block;
}
.modal-img-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: #111;
    border-radius: 18px 18px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 5rem;
}

.modal-body { padding: 1.5rem; }

.modal-badge { margin-bottom: .5rem; }

.modal-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: .3rem;
}

.modal-price {
    color: var(--red);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.modal-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: .9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.modal-meta span { display: flex; align-items: center; gap: 6px; }

.perf-title {
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-bottom: .9rem;
}

.perf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

.perf-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.perf-item-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    font-weight: 600;
}

.perf-icon {
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,.05);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
}

/* ── LOGIN PAGE ──────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: radial-gradient(ellipse at center, #1a0505 0%, #0d0d0d 70%);
}

.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 { font-size: 1.8rem; font-weight: 800; }
.login-logo h1 span { color: var(--red); }
.login-logo p { color: var(--text-muted); font-size: .9rem; margin-top: .3rem; }

.form-group { margin-bottom: 1.2rem; }

.form-label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: .4rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.form-input {
    width: 100%;
    background: var(--bg2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 11px 14px;
    border-radius: 8px;
    font-size: .95rem;
    outline: none;
    transition: border-color .15s;
}
.form-input:focus { border-color: var(--red); }

.form-input.error { border-color: #e63946; }

.alert {
    padding: .8rem 1rem;
    border-radius: 8px;
    font-size: .875rem;
    margin-bottom: 1rem;
}
.alert-error { background: rgba(230,57,70,.15); color: #fca5a5; border: 1px solid rgba(230,57,70,.3); }
.alert-success { background: rgba(34,197,94,.15); color: #86efac; border: 1px solid rgba(34,197,94,.3); }

.btn-block { width: 100%; justify-content: center; padding: 12px; font-size: 1rem; }

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

.sidebar {
    width: 240px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: .2rem;
}
.sidebar-logo a { text-decoration: none; color: inherit; font-size: 1.25rem; font-weight: 900; letter-spacing: -.5px; }
.sidebar-logo a span { color: var(--red); }
.sidebar-sub-label { font-size: .7rem; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; }

.sidebar-nav {
    padding: 1rem .75rem;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem .85rem;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: .835rem;
    font-weight: 500;
    transition: all .15s;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    text-align: left;
}
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-link:hover { background: rgba(255,255,255,.04); color: var(--text); }
.sidebar-link.active { background: rgba(230,57,70,.1); color: var(--red); }
.sidebar-sep { border: none; border-top: 1px solid var(--border); margin: .5rem 0; }
.sidebar-logout { color: var(--red); }
.sidebar-logout:hover { background: rgba(230,57,70,.08); color: var(--red); }

.admin-main { flex: 1; padding: 2rem; min-width: 0; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: gap;
    gap: 1rem;
}

.page-title { font-size: 1.5rem; font-weight: 800; }
.page-title small { display: block; font-size: .85rem; font-weight: 400; color: var(--text-muted); margin-top: 2px; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
}
.stat-card .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: .4rem; }
.stat-card .value { font-size: 2rem; font-weight: 800; }
.stat-card .value.red { color: var(--red); }

.table-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left;
    padding: .9rem 1.2rem;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg2);
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.025); }
tbody td { padding: .85rem 1.2rem; font-size: .875rem; }

.table-img {
    width: 64px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    background: #111;
}

.actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }

/* ── FORM CARD ───────────────────────────────────────── */
.form-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem;
    max-width: 720px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media(max-width:600px) { .form-row { grid-template-columns: 1fr; } }

.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }

.range-wrap { display: flex; align-items: center; gap .75rem; gap: .75rem; }
.range-wrap input[type=range] {
    flex: 1;
    accent-color: var(--red);
    height: 4px;
}
.range-val {
    width: 28px;
    text-align: center;
    font-weight: 700;
    color: var(--red);
    font-size: .9rem;
}

/* ── IMAGE PREVIEW ───────────────────────────────────── */
.img-preview-wrap {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s;
}
.img-preview-wrap:hover { border-color: var(--red); }
.img-preview-wrap img { max-height: 160px; border-radius: 8px; }
.img-placeholder { color: var(--text-muted); font-size: .875rem; }

/* ── EMPTY STATE ─────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-muted);
}
.empty-state .icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.2rem; font-weight: 600; margin-bottom: .5rem; color: var(--text); }

/* ── RESPONSIVE ──────────────────────────────────────── */
@media(max-width:768px) {
    .sidebar { display: none; }
    .hero h1 { font-size: 1.5rem; }
    .perf-grid { grid-template-columns: 1fr 1fr; }
    .navbar { padding: 0 1rem; }
    .container { padding: 1rem; }
}

/* ── SCROLLBAR ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--red); }

/* ── PAGINATION ──────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: .35rem;
    justify-content: center;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.pagination > a, .pagination > span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 .5rem;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-muted);
    border: 1px solid var(--border);
    background: var(--card);
    transition: border-color .15s, color .15s, background .15s;
}
.pagination > a:hover { border-color: var(--red); color: var(--text); }
.pagination > span.current { background: var(--red); color: #fff; border-color: var(--red); font-weight: 700; }

/* Boutons Précédent / Suivant */
.pagination .pg-arrow {
    gap: .35rem;
    padding: 0 .85rem;
    font-weight: 600;
    color: var(--text);
}
.pagination .pg-arrow:hover { border-color: var(--red); color: var(--red); }
.pagination .pg-arrow.disabled { opacity: .35; pointer-events: none; cursor: default; }

/* Ellipsis */
.pagination .pg-ellipsis {
    border: none;
    background: none;
    color: var(--text-muted);
    letter-spacing: .05em;
    min-width: 24px;
}

/* Hide number input spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button,
.form-input[type=number]::-webkit-inner-spin-button,
.form-input[type=number]::-webkit-outer-spin-button,
.affix-input::-webkit-inner-spin-button,
.affix-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number],
.form-input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* ── Sélecteur véhicules par page ───────────────────────────────────────── */
.per-page-bar { display: flex; align-items: center; justify-content: center; gap: .6rem; margin: 1.5rem 0 .5rem; flex-wrap: wrap; }
.per-page-bar label { font-size: .82rem; color: var(--text-muted); }
.per-page-select {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 10px 38px 10px 14px;
    font-size: .9rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    appearance: none;
    transition: border-color .15s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e63946' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}
.per-page-select:hover,
.per-page-select:focus { border-color: var(--red); }
.per-page-select option { background: var(--card); }
