/* ============================================================
   QRwheels — Design System
   Dark premium aesthetic with gold accents
   Mobile-first
   ============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --gold:       #d4af37;
    --gold-light: #e8c84e;
    --gold-dark:  #a88a20;
    --dark-900:   #0a0a0f;
    --dark-800:   #0f0f18;
    --dark-700:   #16161f;
    --dark-600:   #1e1e2a;
    --dark-500:   #2a2a38;
    --dark-400:   #3a3a4f;
    --gray-300:   #9a9ab0;
    --gray-200:   #c4c4d8;
    --white:      #f5f5fa;
    --success:    #22c55e;
    --error:      #ef4444;
    --warning:    #f59e0b;
    --info:       #3b82f6;

    --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:  'Courier New', monospace;

    --radius-sm:  4px;
    --radius:     8px;
    --radius-lg:  16px;
    --radius-xl:  24px;
    --radius-full:9999px;

    --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
    --shadow:     0 4px 16px rgba(0,0,0,.5);
    --shadow-lg:  0 8px 32px rgba(0,0,0,.6);
    --shadow-gold:0 4px 24px rgba(212,175,55,.25);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-sans);
    background: var(--dark-900);
    color: var(--white);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: var(--gold); text-decoration: none; transition: color .2s; }
a:hover { color: var(--gold-light); }

img { max-width: 100%; height: auto; display: block; }

/* ---- Typography ---- */
h1, h2, h3, h4, h5 { line-height: 1.2; font-weight: 700; }
h1 { font-size: clamp(1.8rem, 5vw, 3rem); }
h2 { font-size: clamp(1.4rem, 4vw, 2.2rem); }
h3 { font-size: clamp(1.2rem, 3vw, 1.6rem); }
h4 { font-size: 1.1rem; }

p { margin-bottom: .75rem; color: var(--gray-200); }
p:last-child { margin-bottom: 0; }

.text-gold  { color: var(--gold); }
.text-muted { color: var(--gray-300); }
.text-white { color: var(--white); }
.text-center { text-align: center; }
.text-sm    { font-size: .875rem; }
.text-xs    { font-size: .75rem; }
.font-bold  { font-weight: 700; }
.font-mono  { font-family: var(--font-mono); }

/* ---- Layout ---- */
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
.container-sm { max-width: 640px; }
.container-md { max-width: 800px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }

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

@media (max-width: 640px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .sm-flex-col { flex-direction: column; }
    .sm-hidden { display: none; }
}

/* ---- Spacing utilities ---- */
.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}
.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-12{margin-top:3rem}
.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}
.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}
.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}
.px-4{padding-left:1rem;padding-right:1rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}
.py-4{padding-top:1rem;padding-bottom:1rem}.py-8{padding-top:2rem;padding-bottom:2rem}
.py-16{padding-top:4rem;padding-bottom:4rem}

/* ---- Navigation ---- */
.nav {
    background: rgba(10,10,15,.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(212,175,55,.15);
    position: sticky; top: 0; z-index: 100;
    padding: .75rem 0;
}

.nav-inner { display: flex; align-items: center; justify-content: space-between; }

.nav-logo {
    font-size: 1.4rem; font-weight: 800; letter-spacing: -.5px;
    color: var(--white);
}
.nav-logo span { color: var(--gold); }

.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a { color: var(--gray-200); font-size: .9rem; font-weight: 500; }
.nav-links a:hover { color: var(--gold); }

.nav-btn {
    background: var(--gold); color: var(--dark-900) !important;
    padding: .4rem 1rem; border-radius: var(--radius);
    font-weight: 700; font-size: .85rem;
}
.nav-btn:hover { background: var(--gold-light); color: var(--dark-900) !important; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .65rem 1.4rem; border-radius: var(--radius);
    font-weight: 600; font-size: .9rem; cursor: pointer;
    border: none; transition: all .2s; text-align: center;
    text-decoration: none; line-height: 1.3;
    -webkit-appearance: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
    background: var(--gold); color: var(--dark-900);
    box-shadow: var(--shadow-gold);
}
.btn-primary:hover:not(:disabled) { background: var(--gold-light); color: var(--dark-900); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-outline {
    background: transparent; color: var(--gold);
    border: 1.5px solid var(--gold);
}
.btn-outline:hover { background: rgba(212,175,55,.08); }

.btn-ghost {
    background: transparent; color: var(--gray-200);
}
.btn-ghost:hover { color: var(--white); background: var(--dark-600); }

.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-sm  { padding: .4rem .9rem; font-size: .8rem; }
.btn-lg  { padding: .9rem 2rem; font-size: 1rem; }
.btn-xl  { padding: 1.1rem 2.5rem; font-size: 1.1rem; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }

/* ---- Cards ---- */
.card {
    background: var(--dark-700);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.card-dark {
    background: var(--dark-800);
}

.card-gold-border {
    border-color: rgba(212,175,55,.3);
}

.card-hover {
    transition: transform .2s, box-shadow .2s;
    cursor: pointer;
}
.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* ---- Forms ---- */
.form-group { margin-bottom: 1.25rem; }
.form-label {
    display: block; font-size: .85rem; font-weight: 600;
    color: var(--gray-200); margin-bottom: .35rem; letter-spacing: .3px;
}
.form-label .required { color: var(--gold); margin-left: .2rem; }

.form-control {
    width: 100%; padding: .7rem .9rem;
    background: var(--dark-600); border: 1.5px solid rgba(255,255,255,.1);
    border-radius: var(--radius); color: var(--white); font-size: .95rem;
    transition: border-color .2s, box-shadow .2s;
    -webkit-appearance: none;
    font-family: inherit;
}
.form-control::placeholder { color: var(--dark-400); }
.form-control:focus {
    outline: none; border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212,175,55,.15);
}
.form-control:disabled { opacity: .5; cursor: not-allowed; }

select.form-control { cursor: pointer; }
select.form-control option { background: var(--dark-700); }

textarea.form-control { min-height: 100px; resize: vertical; }

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

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

/* Checkbox */
.form-check { display: flex; align-items: center; gap: .6rem; cursor: pointer; }
.form-check input[type="checkbox"] {
    width: 1.1rem; height: 1.1rem; cursor: pointer;
    accent-color: var(--gold);
}

/* ---- Alerts / Flash messages ---- */
.alert {
    padding: .85rem 1.1rem; border-radius: var(--radius);
    font-size: .9rem; font-weight: 500; margin-bottom: 1rem;
    display: flex; align-items: flex-start; gap: .5rem;
}
.alert-error   { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.12);  border: 1px solid rgba(34,197,94,.3);  color: #86efac; }
.alert-info    { background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.3); color: #93c5fd; }
.alert-warning { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.3); color: #fcd34d; }

/* ---- Badges ---- */
.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .2rem .65rem; border-radius: var(--radius-full);
    font-size: .72rem; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
}
.badge-success { background: rgba(34,197,94,.15);  color: #22c55e; }
.badge-danger  { background: rgba(239,68,68,.15);  color: #ef4444; }
.badge-warning { background: rgba(245,158,11,.15); color: #f59e0b; }
.badge-info    { background: rgba(59,130,246,.15); color: #3b82f6; }
.badge-gold    { background: rgba(212,175,55,.15); color: var(--gold); }
.badge-gray    { background: rgba(154,154,176,.15); color: var(--gray-300); }

/* ---- Divider ---- */
.divider {
    border: none; border-top: 1px solid rgba(255,255,255,.08);
    margin: 1.5rem 0;
}
.divider-gold { border-color: rgba(212,175,55,.2); }

/* ---- Section ---- */
.section { padding: 4rem 0; }
.section-sm { padding: 2rem 0; }

.section-title { margin-bottom: 2rem; }
.section-title h2 { margin-bottom: .5rem; }
.section-title p { color: var(--gray-300); max-width: 500px; }

/* ---- Hero ---- */
.hero {
    padding: 5rem 0 4rem;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(212,175,55,.1) 0%, transparent 70%);
    pointer-events: none;
}

/* ---- Package cards ---- */
.package-card {
    background: var(--dark-700);
    border: 2px solid rgba(255,255,255,.06);
    border-radius: var(--radius-xl);
    padding: 2rem 1.5rem;
    text-align: center;
    position: relative;
    transition: transform .2s, border-color .2s;
}
.package-card:hover { transform: translateY(-4px); }
.package-card.featured { border-color: var(--gold); }
.package-card .badge-featured {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: var(--gold); color: var(--dark-900);
    padding: .2rem .8rem; border-radius: var(--radius-full);
    font-size: .72rem; font-weight: 700;
}
.package-price { font-size: 2.5rem; font-weight: 800; color: var(--gold); line-height: 1; }
.package-price span { font-size: .9rem; font-weight: 400; color: var(--gray-300); }
.package-features { list-style: none; margin: 1.25rem 0; text-align: left; }
.package-features li {
    padding: .4rem 0; color: var(--gray-200); font-size: .9rem;
    display: flex; align-items: center; gap: .5rem;
    border-bottom: 1px solid rgba(255,255,255,.04);
}
.package-features li:last-child { border-bottom: none; }
.pkg-check { color: var(--success); font-size: .9rem; }
.pkg-cross  { color: var(--gray-300); font-size: .9rem; }

/* ---- Dashboard ---- */
.dashboard-header {
    background: var(--dark-800);
    border-bottom: 1px solid rgba(255,255,255,.06);
    padding: 1rem 0;
}

.stat-card {
    background: var(--dark-700);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
}
.stat-card .stat-label { font-size: .78rem; color: var(--gray-300); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; color: var(--gold); line-height: 1.2; margin-top: .2rem; }

/* ---- Steps / Progress ---- */
.steps {
    display: flex; align-items: center; gap: 0; margin-bottom: 2rem;
}
.step {
    display: flex; align-items: center; flex: 1;
}
.step-dot {
    width: 2rem; height: 2rem; border-radius: 50%;
    background: var(--dark-500); border: 2px solid rgba(255,255,255,.1);
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 700; color: var(--gray-300);
    flex-shrink: 0;
    transition: all .3s;
}
.step.active .step-dot   { background: var(--gold); border-color: var(--gold); color: var(--dark-900); }
.step.completed .step-dot{ background: var(--success); border-color: var(--success); color: #fff; }
.step-line {
    flex: 1; height: 2px; background: rgba(255,255,255,.1);
    margin: 0 .5rem;
}
.step.completed + .step .step-line { background: var(--gold); }
.step-label { font-size: .72rem; color: var(--gray-300); margin-top: .3rem; }
.step.active .step-label { color: var(--gold); font-weight: 600; }

/* ---- Image gallery ---- */
.gallery {
    display: grid;
    grid-template-columns: 1fr;
    gap: .5rem;
}
.gallery-main img {
    width: 100%; aspect-ratio: 16/9;
    object-fit: cover; border-radius: var(--radius-lg);
}
.gallery-thumbs {
    display: flex; gap: .5rem; overflow-x: auto;
    padding-bottom: .25rem;
}
.gallery-thumbs img {
    width: 80px; height: 60px;
    object-fit: cover; border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer; flex-shrink: 0;
    transition: border-color .2s;
}
.gallery-thumbs img.active { border-color: var(--gold); }

/* ---- Vehicle scan view ---- */
.scan-header {
    background: linear-gradient(to bottom, var(--dark-800), var(--dark-900));
    padding: 1.5rem 0 0;
}
.vehicle-title { font-size: 1.6rem; font-weight: 800; margin-bottom: .25rem; }
.vehicle-subtitle { color: var(--gold); font-size: .9rem; font-weight: 600; }

.specs-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: .75rem;
}
.spec-item {
    background: var(--dark-700);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: var(--radius); padding: .75rem;
}
.spec-label { font-size: .7rem; color: var(--gray-300); text-transform: uppercase; letter-spacing: .5px; margin-bottom: .15rem; }
.spec-value { font-size: .95rem; font-weight: 600; color: var(--white); }

.for-sale-banner {
    background: linear-gradient(135deg, rgba(212,175,55,.15), rgba(212,175,55,.05));
    border: 1px solid rgba(212,175,55,.3);
    border-radius: var(--radius-lg); padding: 1.25rem;
    display: flex; align-items: center; gap: 1rem;
}

/* ---- Admin ---- */
.admin-sidebar {
    width: 220px; flex-shrink: 0;
    background: var(--dark-800);
    border-right: 1px solid rgba(255,255,255,.06);
    min-height: 100vh; padding: 1.5rem 0;
}
.admin-nav-item {
    display: flex; align-items: center; gap: .7rem;
    padding: .7rem 1.25rem; color: var(--gray-200);
    font-size: .88rem; transition: all .2s;
}
.admin-nav-item:hover { background: var(--dark-700); color: var(--white); }
.admin-nav-item.active { color: var(--gold); background: rgba(212,175,55,.07); border-right: 2px solid var(--gold); }

.admin-content { flex: 1; padding: 2rem; min-height: 100vh; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; padding: .75rem 1rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--gray-300); border-bottom: 1px solid rgba(255,255,255,.08); }
td { padding: .75rem 1rem; border-bottom: 1px solid rgba(255,255,255,.04); color: var(--gray-200); vertical-align: middle; }
tr:hover td { background: rgba(255,255,255,.02); }

/* ---- Impersonation banner ---- */
.impersonate-bar {
    background: var(--warning); color: var(--dark-900);
    padding: .6rem 1rem; text-align: center; font-weight: 700; font-size: .85rem;
    position: sticky; top: 0; z-index: 200;
}
.impersonate-bar a { color: var(--dark-900); text-decoration: underline; }

/* ---- Footer ---- */
.footer {
    background: var(--dark-800);
    border-top: 1px solid rgba(255,255,255,.06);
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
}
.footer-logo { font-size: 1.2rem; font-weight: 800; color: var(--white); margin-bottom: .5rem; }
.footer-logo span { color: var(--gold); }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.footer-links a { color: var(--gray-300); font-size: .85rem; }
.footer-links a:hover { color: var(--gold); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.06); margin-top: 2rem; padding-top: 1rem; font-size: .78rem; color: var(--gray-300); }

/* ---- Misc utilities ---- */
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }
.overflow-hidden { overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.relative { position: relative; }
.sticky { position: sticky; }
.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }
.aspect-video { aspect-ratio: 16/9; }
.object-cover { object-fit: cover; }
.h-full { height: 100%; }

/* ---- Upload zone ---- */
.upload-zone {
    border: 2px dashed rgba(212,175,55,.3);
    border-radius: var(--radius-lg);
    padding: 2rem; text-align: center;
    cursor: pointer; transition: all .2s;
    background: rgba(212,175,55,.03);
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--gold);
    background: rgba(212,175,55,.07);
}
.upload-zone input[type="file"] { display: none; }

/* ---- Inactive page ---- */
.inactive-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 2rem;
}
.inactive-icon { font-size: 4rem; margin-bottom: 1rem; }

/* ---- Loader ---- */
.spinner {
    width: 1.2rem; height: 1.2rem;
    border: 2px solid rgba(255,255,255,.2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .admin-sidebar { display: none; }
    .admin-content { padding: 1rem; }
    .specs-grid { grid-template-columns: 1fr; }
    .for-sale-banner { flex-direction: column; }
    .nav-links { gap: 1rem; }
    .section { padding: 2.5rem 0; }
    .hero { padding: 3rem 0 2rem; }
    .package-card { padding: 1.5rem 1rem; }
}

@media (max-width: 480px) {
    .nav-links .sm-hidden { display: none; }
    .steps { gap: 0; }
    .step-label { display: none; }
}

/* ---- Print ---- */
@media print {
    .nav, .footer, .btn { display: none; }
    body { background: #fff; color: #000; }
}
