/* =====================================================
   VEILLE IMMOBILIÈRE — Charte inspirée Guy Hoquet
   Bleu marine, blanc, épuré, élégant
   ===================================================== */

:root {
    --gh-navy:      #1a2e4a;
    --gh-navy-dark: #111f33;
    --gh-navy-mid:  #243858;
    --gh-blue:      #2563a8;
    --gh-gold:      #c9a84c;
    --gh-red:       #c0392b;
    --gh-green:     #1a7a4a;
    --gh-orange:    #d68910;
    --gh-white:     #ffffff;
    --gh-off-white: #f8f9fb;
    --gh-gray-100:  #f1f3f6;
    --gh-gray-200:  #e4e8ef;
    --gh-gray-400:  #9aa5b4;
    --gh-gray-600:  #5a6678;
    --gh-gray-800:  #2d3748;
    --sidebar-w:    260px;
    --topbar-h:     64px;
    --radius:       8px;
    --shadow-sm:    0 1px 4px rgba(26,46,74,.08);
    --shadow-md:    0 4px 16px rgba(26,46,74,.12);
    --shadow-lg:    0 8px 32px rgba(26,46,74,.16);
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body:    'DM Sans', system-ui, sans-serif;
    --transition:   all .2s ease;
}

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

body {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--gh-gray-800);
    background: var(--gh-off-white);
    display: flex;
    min-height: 100vh;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--gh-navy);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
    transition: var(--transition);
    box-shadow: 4px 0 24px rgba(0,0,0,.18);
}

.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .user-details { display: none; }
.sidebar.collapsed .nav-link { justify-content: center; }
.sidebar.collapsed .brand-triangle { margin: 0 auto; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-triangle {
    width: 0; height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-bottom: 28px solid var(--gh-gold);
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(201,168,76,.4));
}

.brand-text { display: flex; flex-direction: column; }
.brand-name {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--gh-white);
    letter-spacing: .5px;
    line-height: 1;
}
.brand-sub {
    font-size: 10px;
    font-weight: 300;
    color: var(--gh-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 400;
    transition: var(--transition);
    border-left: 3px solid transparent;
    white-space: nowrap;
}
.nav-link i { font-size: 16px; flex-shrink: 0; }
.nav-link:hover {
    color: var(--gh-white);
    background: rgba(255,255,255,.06);
    border-left-color: rgba(201,168,76,.4);
}
.nav-link.active {
    color: var(--gh-white);
    background: rgba(255,255,255,.1);
    border-left-color: var(--gh-gold);
    font-weight: 500;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--gh-gold);
    color: var(--gh-navy);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.user-details { flex: 1; overflow: hidden; }
.user-name {
    display: block;
    color: var(--gh-white);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    display: block;
    color: var(--gh-gray-400);
    font-size: 11px;
    text-transform: capitalize;
}
.btn-logout {
    color: rgba(255,255,255,.4);
    text-decoration: none;
    font-size: 18px;
    transition: var(--transition);
    flex-shrink: 0;
}
.btn-logout:hover { color: var(--gh-red); }

/* ===================== MAIN ===================== */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}
.main-content.expanded { margin-left: 64px; }

/* ===================== TOPBAR ===================== */
.topbar {
    height: var(--topbar-h);
    background: var(--gh-white);
    border-bottom: 1px solid var(--gh-gray-200);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}
.sidebar-toggle {
    background: none; border: none;
    font-size: 22px;
    color: var(--gh-gray-600);
    cursor: pointer;
    padding: 4px;
    transition: var(--transition);
    border-radius: 4px;
}
.sidebar-toggle:hover { color: var(--gh-navy); background: var(--gh-gray-100); }

.page-title { flex: 1; }
.page-title h1 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    color: var(--gh-navy);
    letter-spacing: .3px;
}
.topbar-actions { display: flex; gap: 8px; }

/* ===================== CONTENT ===================== */
.content-wrapper { padding: 28px; flex: 1; }

/* ===================== CARDS ===================== */
.card {
    background: var(--gh-white);
    border: 1px solid var(--gh-gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gh-gray-200);
    background: var(--gh-white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-header h5 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--gh-navy);
    margin: 0;
}
.card-body { padding: 20px; }

/* ===================== KPI CARDS ===================== */
.kpi-card {
    background: var(--gh-white);
    border: 1px solid var(--gh-gray-200);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border-left: 4px solid var(--gh-navy);
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-card.kpi-new   { border-left-color: var(--gh-green); }
.kpi-card.kpi-gone  { border-left-color: var(--gh-red); }
.kpi-card.kpi-price { border-left-color: var(--gh-orange); }
.kpi-card.kpi-dup   { border-left-color: var(--gh-blue); }

.kpi-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    background: var(--gh-gray-100);
    color: var(--gh-navy);
}
.kpi-new  .kpi-icon { background: rgba(26,122,74,.1);  color: var(--gh-green); }
.kpi-gone .kpi-icon { background: rgba(192,57,43,.1);  color: var(--gh-red); }
.kpi-price .kpi-icon{ background: rgba(214,137,16,.1); color: var(--gh-orange); }
.kpi-dup  .kpi-icon { background: rgba(37,99,168,.1);  color: var(--gh-blue); }

.kpi-value {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    color: var(--gh-navy);
    line-height: 1;
}
.kpi-label {
    font-size: 12px;
    color: var(--gh-gray-600);
    font-weight: 400;
    margin-top: 3px;
}

/* ===================== BADGES STATUT ===================== */
.badge-active   { background: rgba(26,122,74,.12);  color: var(--gh-green);  font-weight: 500; }
.badge-disparue { background: rgba(192,57,43,.12);  color: var(--gh-red);    font-weight: 500; }
.badge-nouvelle { background: rgba(37,99,168,.12);  color: var(--gh-blue);   font-weight: 500; }
.badge-prix     { background: rgba(214,137,16,.12); color: var(--gh-orange); font-weight: 500; }
.badge-doublon  { background: rgba(90,102,120,.12); color: var(--gh-gray-600); font-weight: 500; }

/* ===================== TABLE ===================== */
.table-immo {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.table-immo thead th {
    background: var(--gh-navy);
    color: rgba(255,255,255,.85);
    padding: 11px 14px;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .6px;
    white-space: nowrap;
    border: none;
}
.table-immo thead th:first-child { border-radius: 6px 0 0 0; }
.table-immo thead th:last-child  { border-radius: 0 6px 0 0; }
.table-immo tbody tr {
    border-bottom: 1px solid var(--gh-gray-100);
    transition: var(--transition);
}
.table-immo tbody tr:hover { background: var(--gh-gray-100); }
.table-immo tbody td { padding: 12px 14px; vertical-align: middle; }
.table-immo .row-nouvelle { border-left: 3px solid var(--gh-green); }
.table-immo .row-disparue { border-left: 3px solid var(--gh-red); opacity: .75; }
.table-immo .row-prix     { border-left: 3px solid var(--gh-orange); }

/* ===================== ANNONCE CARD ===================== */
.annonce-card {
    background: var(--gh-white);
    border: 1px solid var(--gh-gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.annonce-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.annonce-card .photo {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--gh-gray-100);
    display: flex; align-items: center; justify-content: center;
    color: var(--gh-gray-400);
    font-size: 32px;
}
.annonce-card .photo img { width: 100%; height: 100%; object-fit: cover; }
.annonce-card .info { padding: 14px 16px; }
.annonce-card .prix {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--gh-navy);
}
.annonce-card .titre {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--gh-gray-800);
    margin: 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.annonce-card .meta {
    font-size: 12px;
    color: var(--gh-gray-600);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.annonce-card .meta span { display: flex; align-items: center; gap: 4px; }

/* ===================== FILTRES ===================== */
.filters-bar {
    background: var(--gh-white);
    border: 1px solid var(--gh-gray-200);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.filters-bar .form-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--gh-gray-600);
    margin-bottom: 4px;
}
.form-select, .form-control {
    font-size: 13.5px;
    border: 1px solid var(--gh-gray-200);
    border-radius: 6px;
    color: var(--gh-gray-800);
    transition: var(--transition);
}
.form-select:focus, .form-control:focus {
    border-color: var(--gh-navy);
    box-shadow: 0 0 0 3px rgba(26,46,74,.1);
}

/* ===================== BOUTONS ===================== */
.btn-primary {
    background: var(--gh-navy);
    border-color: var(--gh-navy);
    font-size: 13.5px;
    font-weight: 500;
    padding: 8px 18px;
    border-radius: 6px;
    transition: var(--transition);
}
.btn-primary:hover { background: var(--gh-navy-dark); border-color: var(--gh-navy-dark); }

.btn-gold {
    background: var(--gh-gold);
    border-color: var(--gh-gold);
    color: var(--gh-navy);
    font-size: 13.5px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 6px;
    transition: var(--transition);
}
.btn-gold:hover { background: #b8963e; border-color: #b8963e; color: var(--gh-navy); }

.btn-outline-navy {
    border: 1.5px solid var(--gh-navy);
    color: var(--gh-navy);
    background: transparent;
    font-size: 13.5px;
    font-weight: 500;
    padding: 7px 16px;
    border-radius: 6px;
    transition: var(--transition);
}
.btn-outline-navy:hover { background: var(--gh-navy); color: var(--gh-white); }

/* ===================== RUN STATUS ===================== */
.run-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 6px;
}
.run-status.succes  { background: rgba(26,122,74,.1);  color: var(--gh-green); }
.run-status.echec   { background: rgba(192,57,43,.1);  color: var(--gh-red); }
.run-status.warning { background: rgba(214,137,16,.1); color: var(--gh-orange); }
.run-status i { font-size: 16px; }

/* ===================== DOUBLON COMPARE ===================== */
.doublon-side {
    border: 2px solid var(--gh-gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}
.doublon-side:hover { border-color: var(--gh-navy); }

/* ===================== PRIX HISTORY ===================== */
.prix-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.prix-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--gh-gray-100);
    border-radius: 6px;
    font-size: 13px;
}
.prix-history-item .prix-val {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--gh-navy);
    font-size: 16px;
}
.prix-down { color: var(--gh-green); }
.prix-up   { color: var(--gh-red); }

/* ===================== LOGIN ===================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    background: var(--gh-navy);
}
.login-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: linear-gradient(135deg, var(--gh-navy-dark) 0%, var(--gh-navy-mid) 100%);
    position: relative;
    overflow: hidden;
}
.login-left::before {
    content: '';
    position: absolute;
    top: -100px; right: -100px;
    width: 400px; height: 400px;
    border: 60px solid rgba(201,168,76,.08);
    border-radius: 50%;
}
.login-left::after {
    content: '';
    position: absolute;
    bottom: -80px; left: -80px;
    width: 300px; height: 300px;
    border: 40px solid rgba(201,168,76,.05);
    border-radius: 50%;
}
.login-brand {
    text-align: center;
    color: var(--gh-white);
    position: relative;
    z-index: 1;
}
.login-triangle {
    width: 0; height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-bottom: 70px solid var(--gh-gold);
    margin: 0 auto 24px;
    filter: drop-shadow(0 4px 12px rgba(201,168,76,.5));
}
.login-brand h1 {
    font-family: var(--font-display);
    font-size: 42px;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1;
    margin-bottom: 8px;
}
.login-brand p {
    font-size: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--gh-gold);
    font-weight: 300;
}
.login-right {
    width: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gh-white);
    padding: 48px 40px;
}
.login-form-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    color: var(--gh-navy);
    margin-bottom: 6px;
}

/* ===================== ALERTS ===================== */
.alert {
    border: none;
    border-radius: var(--radius);
    font-size: 13.5px;
    padding: 12px 16px;
}
.alert-success { background: rgba(26,122,74,.1);  color: var(--gh-green); }
.alert-danger  { background: rgba(192,57,43,.1);  color: var(--gh-red); }
.alert-warning { background: rgba(214,137,16,.1); color: var(--gh-orange); }
.alert-info    { background: rgba(37,99,168,.1);  color: var(--gh-blue); }

/* ===================== PAGINATION ===================== */
.pagination .page-link {
    color: var(--gh-navy);
    border-color: var(--gh-gray-200);
    font-size: 13px;
}
.pagination .page-item.active .page-link {
    background: var(--gh-navy);
    border-color: var(--gh-navy);
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .login-left { display: none; }
    .login-right { width: 100%; }
}
