/* =========================================================
   Car Stock - Custom Theme
   ========================================================= */
:root {
    --navy: #0f1b2d;
    --navy-light: #16273f;
    --gold: #c9a34e;
    --gold-dark: #a9822f;
    --bg: #f5f6f8;
    --text: #1e2530;
    --muted: #6b7480;
    --border: #e3e6eb;
    --white: #ffffff;
    --green: #1f9d55;
    --amber: #d69e2e;
    --red: #d64545;
    --radius: 10px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- Top bar ---------- */
.site-header {
    background: var(--navy);
    color: var(--white);
    padding: 16px 0;
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--white);
}
.brand span { color: var(--gold); }
.header-contact {
    font-size: 14px;
    color: #cfd6e0;
}

/* ---------- Filter bar ---------- */
.filter-bar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.filter-form input,
.filter-form select {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--white);
}
.filter-form button {
    background: var(--navy);
    color: var(--white);
    border: none;
    padding: 9px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}
.filter-form button:hover { background: var(--navy-light); }

/* ---------- Car Grid ---------- */
.section-title {
    margin: 28px 0 16px;
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
}
.car-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 20px;
    padding-bottom: 40px;
}
.car-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform .15s ease, box-shadow .15s ease;
}
.car-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(15,27,45,0.12);
}
.car-card .photo-wrap {
    position: relative;
    aspect-ratio: 4/3;
    background: #eef0f3;
    overflow: hidden;
}
.car-card .photo-wrap img { width: 100%; height: 100%; object-fit: cover; }
.car-card .no-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--muted);
    font-size: 13px;
}
.badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--white);
}
.badge-available { background: var(--green); }
.badge-reserved  { background: var(--amber); }
.badge-booked    { background: #3a7bd5; }
.badge-sold      { background: var(--red); }
.badge-default   { background: var(--muted); }

.car-card .info { padding: 14px 16px; }
.car-card .info h3 {
    margin: 0 0 6px;
    font-size: 16px;
    color: var(--navy);
}
.car-card .meta {
    font-size: 13px;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-bottom: 10px;
}
.car-card .view-btn {
    display: inline-block;
    margin-top: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gold-dark);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

/* ---------- Shared Collection Additions ---------- */
.collection-header { 
    background: transparent; 
    padding: 30px 20px 10px; 
    text-align: left; 
    margin-bottom: 20px; 
    color: var(--navy);
}
.collection-title { 
    font-size: 26px; 
    font-weight: 700; 
    letter-spacing: -0.5px;
    margin-bottom: 6px;
    color: var(--navy);
}
.collection-subtitle {
    color: var(--muted);
    font-size: 15px;
    max-width: 100%;
}
.price-tag-visible { 
    display: inline-block; 
    background: #f8f9fa; 
    color: var(--navy); 
    padding: 6px 12px; 
    border: 1px solid var(--border);
    border-radius: 6px; 
    font-weight: 700; 
    margin-top: 8px; 
    font-size: 15px; 
}

/* ---------- Single Car Page ---------- */
.car-detail {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    margin: 24px 0 40px;
}
.gallery-main {
    aspect-ratio: 16/9;
    background: #eef0f3;
    overflow: hidden;
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
}
.gallery-thumbs img {
    width: 72px; height: 54px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    flex-shrink: 0;
}
.gallery-thumbs img.active { border-color: var(--gold); }

.detail-body { padding: 24px; }
.detail-body h1 {
    margin: 0 0 8px;
    font-size: 24px;
    color: var(--navy);
}
.spec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin: 20px 0;
    padding: 18px;
    background: var(--bg);
    border-radius: 8px;
}
.spec-item .label { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.spec-item .value { font-size: 15px; font-weight: 600; color: var(--text); }
.spec-block { margin: 20px 0; line-height: 1.7; }
.spec-block h3 { color: var(--navy); font-size: 16px; margin-bottom: 8px; }
.price-box {
    background: var(--navy);
    color: var(--white);
    padding: 16px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.price-box .price { font-size: 22px; font-weight: 700; color: var(--gold); }
.contact-btn {
    display: inline-block;
    background: var(--gold);
    color: var(--navy);
    font-weight: 700;
    padding: 10px 22px;
    border-radius: 6px;
}

/* ---------- Admin ---------- */
.admin-body { background: var(--bg); min-height: 100vh; }
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px;
    background: var(--navy);
    color: var(--white);
    padding: 20px 0;
    flex-shrink: 0;
}
.sidebar .brand { padding: 0 20px 20px; font-size: 18px; }
.sidebar a {
    display: block;
    padding: 12px 20px;
    color: #cfd6e0;
    font-size: 14px;
}
.sidebar a:hover, .sidebar a.active { background: var(--navy-light); color: var(--white); }
.admin-main { flex: 1; padding: 24px 30px; }
.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 20px;
}
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.stat-box { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-box .num { font-size: 26px; font-weight: 700; color: var(--navy); }
.stat-box .lbl { color: var(--muted); font-size: 13px; }

table.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.admin-table th, table.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
table.admin-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
table.admin-table tr:hover { background: #fafbfc; }
.thumb-sm { width: 56px; height: 42px; object-fit: cover; border-radius: 4px; }

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    cursor: pointer;
    font-weight: 600;
}
.btn-primary { background: var(--navy); color: var(--white); }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 14px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.form-group textarea { resize: vertical; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #e6f7ec; color: var(--green); border: 1px solid #b7e8c6; }
.alert-error { background: #fdecec; color: var(--red); border: 1px solid #f5c2c2; }

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy);
}
.login-box {
    background: var(--white);
    padding: 36px 32px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 380px;
}
.login-box h1 { text-align: center; color: var(--navy); font-size: 20px; margin-bottom: 20px; }
.login-box button { width: 100%; padding: 11px; background: var(--gold); color: var(--navy); font-weight: 700; border: none; border-radius: 6px; cursor: pointer; }

.share-link-box {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--bg);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
}
.share-link-box input { flex: 1; border: none; background: transparent; font-size: 13px; }

.menu-toggle { display: none; background: transparent; border: none; color: var(--navy); font-size: 26px; cursor: pointer; padding: 0; margin-right: 15px; }
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 998; }
.sidebar-overlay.active { display: block; }
.admin-topbar-header { display: flex; align-items: center; }

@media (max-width: 768px) {
    .admin-shell { display: block !important; }
    
    /* Sidebar off-canvas for mobile */
    .admin-shell .sidebar { 
        position: fixed !important; 
        top: 0; 
        left: -300px !important; 
        bottom: 0; 
        width: 260px !important; 
        z-index: 9999 !important; 
        transition: left 0.3s ease !important;
        box-shadow: 2px 0 10px rgba(0,0,0,0.5);
        display: block !important;
    }
    
    /* Show sidebar when active class is added */
    .admin-shell .sidebar.active { 
        left: 0 !important; 
    }
    
    .menu-toggle { display: inline-block !important; margin-right: 15px; }
    .form-grid { grid-template-columns: 1fr !important; }
    .admin-main { padding: 15px !important; width: 100% !important; display: block !important; margin-left: 0 !important; }
    
    /* Topbar adjustments for mobile */
    .admin-topbar { 
        display: block !important; 
        margin-bottom: 20px;
    }
    .admin-topbar-header { 
        display: flex !important; 
        align-items: center; 
        margin-bottom: 8px;
    }
    
    /* Form and table adjustments */
    .filter-form { display: flex !important; flex-direction: column !important; gap: 10px; }
    .filter-form input, .filter-form select, .filter-form button { width: 100% !important; flex: none !important; }
    .share-link-box { display: block !important; }
    .share-link-box input { width: 100% !important; margin-bottom: 8px; padding: 10px !important; }
    .share-link-box button { width: 100% !important; }
    
    /* Make table scrollable horizontally */
    .card { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
    table.admin-table { min-width: 600px !important; }
}

/* ====== PREMIUM SAAS UI UPGRADES ====== */

/* Modern Card Shadows and Rounded Corners */
.card {
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid #f3f4f6;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

/* Stat Grid Modernization */
.stat-box {
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #f3f4f6;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.stat-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}
.stat-box .num {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}
.stat-box .lbl {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7480;
    font-weight: 600;
}

/* Soft Badges */
.badge {
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-available { background: #dcfce7 !important; color: #166534 !important; border: none; }
.badge-sold { background: #fee2e2 !important; color: #991b1b !important; border: none; }
.badge-reserved { background: #fef9c3 !important; color: #854d0e !important; border: none; }
.badge-booked { background: #dbeafe !important; color: #1e40af !important; border: none; }

/* Responsive Table Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}
.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.admin-table th {
    background: #f9fafb;
    color: #374151;
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
}
.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    color: #4b5563;
}

/* SVG Sidebar Icons */
.sidebar a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #a1a1aa;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 4px 12px;
}
.sidebar a:hover, .sidebar a.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}
.sidebar a svg {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}
.sidebar a.active svg {
    opacity: 1;
    color: #c9a34e;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 15px;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.filter-bar .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 150px;
}

/* Call Request Modal */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center;
    z-index: 9999;
}
.modal-content {
    background: #fff; padding: 30px; border-radius: 16px; width: 90%; max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}
.modal-content h3 { margin-top: 0; font-size: 20px; }

/* Fix for Admin Table Badges overlapping */
.admin-table .badge, .stat-grid .badge {
    position: static;
    display: inline-block;
    top: auto;
    left: auto;
}
