/* ==========================================================================
   1. VARIABLES GLOBALES (:root)
   ========================================================================== */
:root {
    /* Couleurs Principales */
    --jerus-blue: #0A58CA;
    --jerus-blue-dark: #084298;
    --jerus-green: #3AA935;
    --jerus-green-dark: #2E8B2E;
    
    /* Couleurs Secondaires & Fonds */
    --jerus-bg: #f8f9fa;
    --jerus-gray: #6c757d;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --input-bg: #f8fafc;

    /* Dimensions Dashboard */
    --sidebar-collapsed: 70px;
    --sidebar-expanded: 250px;

    /* Animations */
    --transition-standard: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   2. BASE & TYPOGRAPHIE
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    color: #343a40;
    background: var(--jerus-bg);
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* ==========================================================================
   3. COMPOSANTS RÉUTILISABLES (Boutons, Cartes, Badges)
   ========================================================================== */
/* Boutons */
.btn-vert {
    background: var(--jerus-green);
    color: white;
    border-radius: 50px;
    padding: 12px 30px;
    font-weight: 600;
    border: none;
    transition: var(--transition-standard);
}
.btn-vert:hover {
    background: var(--jerus-green-dark);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(58,169,53,0.3);
    color: white;
}

.btn-primary {
    background: var(--jerus-blue);
    border-color: var(--jerus-blue);
    border-radius: 12px;
    padding: 10px 20px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(10,88,202,0.2);
    transition: var(--transition-standard);
}
.btn-primary:hover {
    background: var(--jerus-blue-dark);
    border-color: var(--jerus-blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(10,88,202,0.3);
}

/* Cartes (Cards) */
.card-custom {
    border: none;
    border-radius: 20px;
    transition: var(--transition-standard);
    background: white;
}
.card-custom:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1) !important;
}

.service-card {
    border: none;
    border-radius: 20px;
    padding: 35px;
    background: white;
    transition: var(--transition-standard);
    height: 100%;
    border-bottom: 4px solid transparent;
}
.service-card:hover {
    transform: translateY(-10px);
    border-bottom-color: var(--jerus-green);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1) !important;
}

/* Utilitaires de fond (Dashboard) */
.bg-green-light { background: rgba(58,169,53,0.12); color: var(--jerus-green); }
.bg-orange-light { background: rgba(253,126,20,0.12); color: #fd7e14; }
.bg-blue-light { background: rgba(10,88,202,0.12); color: var(--jerus-blue); }
.bg-teal-light { background: rgba(25,135,84,0.12); color: #198754; }

/* ==========================================================================
   4. SITE PUBLIC (Landing Page)
   ========================================================================== */
.topbar-public {
    font-size: 0.85rem;
    background-color: var(--jerus-blue);
    color: white;
    padding: 8px 0;
}

.navbar {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    background: rgba(255, 255, 255, 0.98);
}
.navbar-brand img {
    height: 55px;
}
.nav-link {
    font-weight: 500;
    transition: var(--transition-standard);
    color: #444 !important;
}
.nav-link:hover,
.nav-link.active {
    color: var(--jerus-green) !important;
}

.hero {
    padding: 160px 0 100px;
    background: linear-gradient(135deg, rgba(10, 88, 202, 0.9) 0%, rgba(58, 169, 53, 0.8) 100%), 
                url('https://images.unsplash.com/photo-1519494026892-80bbd2d6fd0d?auto=format&fit=crop&q=80');
    background-size: cover;
    background-position: center;
    color: white;
    clip-path: polygon(0 0, 100% 0, 100% 90%, 0% 100%);
}

.stat-box {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}
.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--jerus-blue);
    display: block;
}

.testimonial-card {
    background: var(--jerus-bg);
    border-radius: 20px;
    padding: 30px;
    position: relative;
}
.quote-icon {
    font-size: 2rem;
    color: var(--jerus-green);
    opacity: 0.3;
}

.contact-icon-box {
    width: 50px;
    height: 50px;
    background: rgba(10, 88, 202, 0.1);
    color: var(--jerus-blue);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.map-container {
    border-radius: 20px;
    overflow: hidden;
    height: 100%;
    min-height: 350px;
    border: 1px solid #eee;
}

footer {
    background: #0a2e5c;
    color: #cbd5e1;
    padding: 80px 0 30px;
}

/* ==========================================================================
   5. DASHBOARD & ESPACE PATIENT
   ========================================================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-collapsed);
    background: #fff;
    box-shadow: 0 0 30px rgba(0,0,0,0.06);
    transition: width var(--transition-standard), transform var(--transition-standard);
    z-index: 1035;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar.expanded {
    width: var(--sidebar-expanded);
}

.sidebar-header {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-bottom: 1px solid #eef0f2;
    flex-shrink: 0;
}

.logo-collapsed {
    width: 42px;
    height: 42px;
    object-fit: contain;
    transition: opacity 0.2s;
}

.logo-expanded {
    display: none;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.logo-expanded img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    flex-shrink: 0;
}
.logo-expanded span {
    font-weight: 600;
    color: var(--jerus-blue);
    font-size: 0.95rem;
    white-space: nowrap;
    line-height: 1.2;
}

.sidebar.expanded .logo-collapsed { display: none; }
.sidebar.expanded .logo-expanded { display: flex; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #e0e0e0; border-radius: 4px; }

.sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin: 4px 10px;
    color: #5a6473;
    border-radius: 10px;
    border-left: 3px solid transparent;
    white-space: nowrap;
    transition: all 0.2s;
    position: relative;
}
.sidebar .nav-link i {
    font-size: 1.3rem;
    width: 38px;
    min-width: 38px;
    text-align: center;
    flex-shrink: 0;
}
.sidebar .nav-link span {
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.25s ease;
    font-size: 0.92rem;
    font-weight: 500;
    margin-left: 4px;
}
.sidebar.expanded .nav-link span {
    opacity: 1;
    transform: translateX(0);
}
.sidebar .nav-link:hover {
    background: rgba(58, 169, 53, 0.08);
    color: var(--jerus-green);
}
.sidebar .nav-link.active {
    background: #e7f0fd;
    color: var(--jerus-blue);
    border-left-color: var(--jerus-green);
    font-weight: 600;
}
.sidebar .nav-link.active i {
    color: var(--jerus-blue);
}

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid #eef0f2;
    flex-shrink: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    transition: background 0.2s;
    cursor: pointer;
}
.user-profile:hover {
    background: var(--jerus-bg);
}
.user-profile .avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    flex-shrink: 0;
    border: 2px solid #e7f0fd;
}
.user-info {
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.25s;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar.expanded .user-info {
    opacity: 1;
    transform: translateX(0);
}
.user-info .name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.2;
}
.user-info small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-standard);
}

.topbar-dashboard {
    background: #fff;
    padding: 14px 24px;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    border-bottom: 1px solid #f1f3f5;
}

.search-box .input-group {
    border-radius: 12px;
    overflow: hidden;
    background: var(--jerus-bg);
}
.search-box .form-control,
.search-box .input-group-text {
    background: transparent;
    border: 1px solid #e9ecef;
    font-size: 0.9rem;
}
.search-box .form-control:focus {
    box-shadow: none;
    border-color: var(--jerus-blue);
    background: #fff;
}

.topbar-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--jerus-bg);
    border: none;
    color: #5a6473;
    transition: all 0.2s;
    position: relative;
}
.topbar-btn:hover {
    background: #e7f0fd;
    color: var(--jerus-blue);
}

.content {
    padding: 24px;
    flex: 1;
}
.page-header h1 {
    font-weight: 700;
    color: #1a202c;
    font-size: 1.75rem;
}

/* Dashboard Tables & Lists */
.table thead th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #718096;
    font-weight: 600;
    border-bottom: 1px solid #eef0f2;
    padding: 12px;
}
.table tbody td {
    padding: 14px 12px;
    vertical-align: middle;
    border-bottom: 1px solid #f5f6f7;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fcfdff; }

.badge-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.75rem;
}

.alert-item {
    background: var(--jerus-bg);
    border: 1px solid #eef0f2;
    transition: all 0.2s;
}
.alert-item:hover {
    background: #fff;
    border-color: #e0e7ff;
    transform: translateX(2px);
}

.patient-card {
    min-width: 110px;
    background: var(--jerus-bg);
    border-radius: 14px;
    padding: 16px 12px;
    text-align: center;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.patient-card:hover {
    background: #fff;
    border-color: #e7f0fd;
    transform: translateY(-2px);
}

/* ==========================================================================
   6. RESPONSIVE (Média Queries)
   ========================================================================== */
@media (min-width: 992px) {
    .main {
        margin-left: var(--sidebar-collapsed);
    }
    body.sidebar-expanded .main {
        margin-left: var(--sidebar-expanded);
    }
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1030;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-expanded);
    }
    .sidebar .nav-link span,
    .sidebar .user-info { 
        opacity: 1; 
        transform: none; 
    }
    .sidebar .logo-collapsed { display: none; }
    .sidebar .logo-expanded { display: flex; }
    .sidebar.mobile-open { transform: translateX(0); }
    .main { margin-left: 0 !important; }
    .content { padding: 16px; }
    .topbar-dashboard { padding: 12px 16px; }
}