/* ============================================================
   LA-AUTO Panel - Dark Theme
   ============================================================ */

:root {
    --bg-body: #0f0f1a;
    --bg-sidebar: #111827;
    --bg-sidebar-hover: #1f2937;
    --bg-card: #1a1a2e;
    --bg-topbar: #111827;
    --bg-input: #16213e;
    --accent-primary: #3b82f6;
    --accent-red: #e94560;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-purple: #8b5cf6;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #1e293b;
    --sidebar-width: 260px;
    --topbar-height: 60px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    z-index: 1040;
    transition: transform .3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: .5px;
}

.sidebar-brand:hover {
    color: var(--accent-red);
}

.sidebar-brand i {
    color: var(--accent-red);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: .75rem 0;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1.25rem;
    color: var(--text-secondary);
    font-size: .9rem;
    font-weight: 500;
    border-radius: 0;
    transition: all .2s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-sidebar-hover);
}

.sidebar-nav .nav-link.active {
    color: var(--accent-primary);
    background: rgba(59, 130, 246, .08);
    border-left-color: var(--accent-primary);
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
    font-size: .95rem;
}

/* ============================================================
   TOPBAR
   ============================================================ */

.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1030;
    transition: left .3s ease;
}

.page-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.sidebar-toggle {
    text-decoration: none;
    padding: 0;
    border: none;
}

.pulse-badge {
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .4); }
    50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

.topbar-user {
    color: var(--text-secondary);
    font-size: .9rem;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.main-wrapper {
    margin-left: var(--sidebar-width);
    transition: margin-left .3s ease;
}

.main-content {
    padding: calc(var(--topbar-height) + 1.5rem) 1.5rem 2rem;
    min-height: 100vh;
}

/* ============================================================
   CARDS (KPI / General)
   ============================================================ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: .75rem;
}

.kpi-card {
    position: relative;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .3);
}

.kpi-card .kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: .5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.kpi-card .kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.kpi-card .kpi-label {
    font-size: .8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================================
   TABLES
   ============================================================ */

.table-dark-custom {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-color);
    --bs-table-hover-bg: rgba(255, 255, 255, .03);
    --bs-table-striped-bg: rgba(255, 255, 255, .015);
    font-size: .875rem;
}

.table-dark-custom thead th {
    background: rgba(0, 0, 0, .2);
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    padding: .75rem;
}

.table-dark-custom td {
    padding: .65rem .75rem;
    vertical-align: middle;
}

.table-dark-custom .img-thumb {
    width: 80px;
    height: 55px;
    object-fit: cover;
    border-radius: .375rem;
}

/* ============================================================
   BADGES
   ============================================================ */

.badge-coup-coeur { background: var(--accent-red); }
.badge-a-saisir { background: var(--accent-orange); }
.badge-bonne-affaire { background: var(--accent-green); }
.badge-plateforme {
    background: rgba(59, 130, 246, .15);
    color: var(--accent-primary);
    font-weight: 500;
}

/* Status badges */
.badge-statut-a-contacter { background: rgba(245, 158, 11, .15); color: var(--accent-orange); }
.badge-statut-en-negociation { background: rgba(139, 92, 246, .15); color: var(--accent-purple); }
.badge-statut-signe { background: rgba(59, 130, 246, .15); color: var(--accent-primary); }
.badge-statut-en-vente { background: rgba(16, 185, 129, .15); color: var(--accent-green); }
.badge-statut-vendu { background: rgba(100, 116, 139, .15); color: #94a3b8; }

/* ============================================================
   SCORE INDICATORS
   ============================================================ */

.score-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8rem;
    border: 2px solid;
}

.score-high { border-color: var(--accent-green); color: var(--accent-green); }
.score-medium { border-color: var(--accent-orange); color: var(--accent-orange); }
.score-low { border-color: var(--accent-red); color: var(--accent-red); }

.ecart-positive { color: var(--accent-red); }
.ecart-negative { color: var(--accent-green); }

/* ============================================================
   FILTERS BAR
   ============================================================ */

.filters-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: .75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.filters-bar .form-select,
.filters-bar .form-control {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
    font-size: .85rem;
}

.filters-bar .form-select:focus,
.filters-bar .form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 .15rem rgba(59, 130, 246, .25);
}

/* ============================================================
   ACTIVITY TIMELINE
   ============================================================ */

.timeline-item {
    display: flex;
    gap: .75rem;
    padding: .6rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: .85rem;
}

.timeline-item:last-child { border-bottom: none; }

.timeline-time {
    color: var(--text-secondary);
    min-width: 45px;
    font-weight: 500;
}

.timeline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

/* ============================================================
   DETAIL PAGE
   ============================================================ */

.gallery-main {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: .75rem;
}

.gallery-thumbs img {
    width: 100px;
    height: 65px;
    object-fit: cover;
    border-radius: .375rem;
    cursor: pointer;
    opacity: .6;
    transition: opacity .2s;
}

.gallery-thumbs img:hover,
.gallery-thumbs img.active {
    opacity: 1;
    outline: 2px solid var(--accent-primary);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: .55rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: .9rem;
}

.info-row:last-child { border-bottom: none; }

.info-label { color: var(--text-secondary); }
.info-value { font-weight: 600; }

.price-box {
    text-align: center;
    padding: 1.25rem;
    border-radius: .75rem;
}

.price-box .price-main {
    font-size: 1.75rem;
    font-weight: 700;
}

.price-box .price-label {
    font-size: .8rem;
    color: var(--text-secondary);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .4);
}

.login-card .login-logo {
    font-size: 2.5rem;
    color: var(--accent-red);
    margin-bottom: .5rem;
}

.login-card .login-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: .25rem;
}

.login-card .login-subtitle {
    color: var(--text-secondary);
    font-size: .9rem;
    margin-bottom: 2rem;
}

.login-card .form-control {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
    padding: .75rem 1rem;
    font-size: .95rem;
}

.login-card .form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 .2rem rgba(59, 130, 246, .25);
}

.login-card .btn-login {
    background: var(--accent-red);
    border: none;
    padding: .75rem;
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
    border-radius: .5rem;
    transition: all .2s;
}

.login-card .btn-login:hover {
    background: #d63a54;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(233, 69, 96, .3);
}

/* ============================================================
   SETTINGS
   ============================================================ */

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: .75rem;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.settings-section h6 {
    color: var(--accent-primary);
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: .95rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

.sidebar-collapsed .main-wrapper {
    margin-left: 0;
}

.sidebar-collapsed .topbar {
    left: 0;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .topbar {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .5);
        z-index: 1035;
    }

    .sidebar.show ~ .sidebar-overlay {
        display: block;
    }
}

@media (max-width: 575.98px) {
    .main-content {
        padding: calc(var(--topbar-height) + 1rem) 1rem 1.5rem;
    }

    .kpi-card .kpi-value {
        font-size: 1.4rem;
    }
}
