/* ===== VARIABLES ===== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #0ea5e9;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #1e1b4b;
    --text: #1e293b;
    --text-light: #64748b;
    --text-sidebar: #c7d2fe;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #0c0a1f;
    --text: #f1f5f9;
    --text-light: #94a3b8;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.4);
}

/* ===== RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== NOTIFICATIONS ===== */
#notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 16px 24px;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(100%); }
}

/* ===== NAVBAR ===== *//* ===== NAVBAR PUBLIQUE MODERNE ===== *//* ===== NAVBAR PUBLIQUE MODERNE ===== */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--hp-transition);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .navbar {
    background: #1e293b;
    border-bottom-color: #334155;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

.navbar-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Brand */
.navbar-brand {
    font-size: 1.45rem;
    font-weight: 800;
    color: #2563eb;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: var(--hp-transition);
    z-index: 1001;
}
.navbar-brand:hover { opacity: 0.85; }

/* Menu Desktop */
.navbar-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 4px;
}

.navbar-menu a {
    text-decoration: none;
    color: #64748b;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 10px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    z-index: 1001;
}

.navbar-menu a:hover {
    color: #2563eb;
    background: #eff6ff;
}

[data-theme="dark"] .navbar-menu a:hover {
    background: #334155;
}

.navbar-menu a.active {
    color: #2563eb;
    background: #dbeafe;
    font-weight: 600;
}

[data-theme="dark"] .navbar-menu a.active {
    color: #93c5fd;
    background: #1e40af;
}

.navbar-menu a.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: #2563eb;
    border-radius: 2px;
}

/* Actions */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1001;
}

.theme-toggle,
.mobile-menu-toggle {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    font-size: 1.1rem;
    color: #475569;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

[data-theme="dark"] .theme-toggle,
[data-theme="dark"] .mobile-menu-toggle {
    background: #334155;
    border-color: #475569;
    color: #cbd5e1;
}

.theme-toggle:hover,
.mobile-menu-toggle:hover {
    background: #e2e8f0;
    color: #2563eb;
    transform: translateY(-1px);
}

[data-theme="dark"] .theme-toggle:hover,
[data-theme="dark"] .mobile-menu-toggle:hover {
    background: #475569;
}

.mobile-menu-toggle { display: none; }

/* ===== MOBILE MENU - CORRECTION TRANSPARENCE ===== */
@media (max-width: 768px) {
    .navbar-container { padding: 0 16px; }

    .navbar-menu {
        /* Positionnement aligné à DROITE */
        position: absolute;
        top: 72px;
        right: 16px;
        left: auto;
        width: 250px;
        
        /* ✅ FOND OPAQUE GARANTI */
        background: #ffffff !important;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        
        /* ✅ OMBRE PROFONDE POUR LISIBLETÉ */
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15) !important;
        
        flex-direction: column;
        padding: 12px;
        gap: 6px;
        
        /* Animation */
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px) scale(0.98);
        transform-origin: top right;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        pointer-events: none;
        z-index: 999;
    }

    /* ✅ DARK MODE MOBILE - FOND SOMBRE OPAQUE */
    [data-theme="dark"] .navbar-menu {
        background: #1e293b !important;
        border-color: #334155;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4) !important;
    }

    .navbar-menu.open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
        pointer-events: all;
    }

    /* ✅ LIENS MOBILE - CONTRASTE MAXIMUM */
    .navbar-menu a {
        width: 100%;
        padding: 14px 16px;
        border-radius: 8px;
        font-size: 1rem;
        font-weight: 500;
        color: #1e293b !important; /* Texte foncé sur fond clair */
        background: transparent;
        justify-content: space-between;
    }

    [data-theme="dark"] .navbar-menu a {
        color: #f1f5f9 !important; /* Texte clair sur fond sombre */
    }

    .navbar-menu a:hover {
        background: #f1f5f9 !important;
        color: #2563eb !important;
        padding-left: 20px;
    }

    [data-theme="dark"] .navbar-menu a:hover {
        background: #334155 !important;
        color: #93c5fd !important;
    }

    .navbar-menu a.active {
        background: #dbeafe !important;
        color: #1e40af !important;
        font-weight: 600;
    }

    [data-theme="dark"] .navbar-menu a.active {
        background: #1e40af !important;
        color: #bfdbfe !important;
    }

    .navbar-menu a::after { display: none; }

    .mobile-menu-toggle { display: flex; }

    .navbar-actions .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: 0.9rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    color: var(--text-light);
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--border);
}

/* ===== ADMIN LAYOUT ===== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    padding: 0.8rem;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    font-size: 0.9rem;
}

.sidebar-brand {
    font-size: 1.2rem;
    font-weight: 800;
    color: white;
    padding-bottom: 1.3rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 4px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-sidebar);
    transition: var(--transition);
    font-weight: 400;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-menu i {
    width: 20px;
    text-align: center;
}

.admin-content {
    margin-left: 260px;
    flex: 1;
    padding: 2rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.admin-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

/* ===== CARDS ===== */
.vehicules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
}

.vehicule-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    box-shadow: 5px 10px 5px 5px darkblue !important;
    transition: var(--transition);
    border: 1px solid var(--border);
}

.vehicule-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.vehicule-card-image {
    height: 200px;
    overflow: hidden;
    position: relative;
}

.vehicule-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: var(--success); color: white; }
.badge-warning { background: var(--warning); color: white; }
.badge-danger { background: var(--danger); color: white; }

.badge-carburant {
    position: absolute;
    top: 12px;
    right: 12px;
}

.vehicule-card-body {
    padding: 1.25rem;
}

.vehicule-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.vehicule-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.vehicule-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.vehicule-card-price {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
}

.vehicule-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ===== STATS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue { background: #dbeafe; color: #3b82f6; }
.stat-icon.green { background: #d1fae5; color: #10b981; }
.stat-icon.purple { background: #ede9fe; color: #8b5cf6; }
.stat-icon.orange { background: #ffedd5; color: #f97316; }

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 800;
}

.stat-info p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ===== FORMULAIRES ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

select.form-control {
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* ===== TABLES ===== */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    font-size: 0.9rem;
}

tr:hover td {
    background: var(--bg);
}

/* ===== SEARCH & FILTERS ===== */
.search-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-bar .form-control {
    flex: 1;
    min-width: 200px;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 2rem;
}

.pagination button {
    padding: 8px 14px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    font-family: inherit;
}

.pagination button.active,
.pagination button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== LOGIN ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
}

.login-box {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.6rem;
}

.login-box p {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* ===== HERO ===== */
.hero {
    background: linear-gradient(135deg, #041a7a 0%, #582986 100%);
    color: white;
    padding: 4rem 2rem;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== DETAIL VEHICULE ===== */
.detail-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.detail-images img {
    width: 100%;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.detail-info h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.detail-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
}

.detail-spec {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
}

/* ===== CHART ===== */
.chart-container {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-top: 2rem;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 2rem;
    height: 200px;
    padding: 1rem 0;
}

.bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.bar {
    width: 60px;
    border-radius: 8px 8px 0 0;
    transition: height 0.5s ease;
}

.bar-label {
    font-size: 0.85rem;
    color: var(--text-light);
    text-align: center;
}

.bar-value {
    font-weight: 700;
    font-size: 1.1rem;
}

/* ===== LOADING ===== */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.loading i {
    animation: spin 1s linear infinite;
    font-size: 2rem;
    color: var(--primary);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .admin-content {
        margin-left: 0;
    }
    .vehicules-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    .hero h1 {
        font-size: 2rem;
    }
    .detail-container {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .navbar {
        padding: 1rem;
    }
    .navbar-links {
        gap: 1rem;
    }
}

/* ===== IMAGE UPLOAD PREVIEW ===== */
.image-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 1rem;
}

.image-upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.image-preview img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

