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

:root {
    /* Palette médicale moderne - Bleu médical principal */
    --primary: #0284c7;               /* Bleu médical professionnel - confiance */
    --primary-dark: #0369a1;          /* Bleu médical foncé */
    --primary-light: #e0f2fe;          /* Bleu médical très clair */
    --primary-hover: #0ea5e9;          /* Bleu médical hover */
    
    --secondary: #0d9488;             /* Teal médical - complémentaire */
    --secondary-dark: #0f766e;        /* Teal foncé */
    --secondary-light: #ccfbf1;        /* Teal très clair */
    
    --accent: #06b6d4;                 /* Cyan - fraîcheur et modernité */
    --accent-light: #cffafe;           /* Cyan clair */
    
    --success: #059669;                /* Vert succès (minimal) */
    --warning: #f59e0b;                /* Ambre - attention */
    --danger: #ef4444;                 /* Rouge - urgence */
    --info: #0ea5e9;                   /* Bleu info */
    
    /* Neutres doux et accessibles */
    --background: #f0f9ff;            /* Bleu très clair - apaisant */
    --background-alt: #e0f2fe;        /* Bleu clair alternatif */
    --surface: #ffffff;                /* Blanc pur */
    --surface-elevated: #ffffff;       /* Surface élevée */
    
    /* Texte - Contraste élevé pour accessibilité */
    --text-primary: #0f172a;          /* Presque noir - excellent contraste (WCAG AAA) */
    --text-secondary: #1e293b;         /* Gris foncé - meilleur contraste */
    --text-light: #334155;             /* Gris moyen - contraste amélioré */
    --text-muted: #475569;             /* Gris bleuté - toujours lisible */
    
    /* Bordures et séparateurs - Contraste renforcé */
    --border: #94a3b8;                 /* Bordure plus visible */
    --border-light: #cbd5e1;           /* Bordure claire mais visible */
    --border-strong: #64748b;          /* Bordure forte pour séparation claire */
    --divider: #cbd5e1;                /* Séparateur visible */
    
    /* Ombres douces et modernes */
    --shadow-sm: 0 1px 3px 0 rgba(2, 132, 199, 0.08);
    --shadow: 0 4px 8px -1px rgba(2, 132, 199, 0.12), 0 2px 4px -1px rgba(2, 132, 199, 0.08);
    --shadow-md: 0 10px 20px -3px rgba(2, 132, 199, 0.15), 0 4px 8px -2px rgba(2, 132, 199, 0.1);
    --shadow-lg: 0 20px 30px -5px rgba(2, 132, 199, 0.2), 0 10px 15px -5px rgba(2, 132, 199, 0.1);
    --shadow-xl: 0 25px 50px -12px rgba(2, 132, 199, 0.3);
    
    /* Rayons arrondis */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* Transitions fluides */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease-out;
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #bae6fd 100%);
    background-attachment: fixed;
    min-height: 100vh;
    line-height: 1.7; /* Augmenté pour meilleure lisibilité */
    color: var(--text-primary);
    font-size: 16px; /* Taille de base augmentée pour accessibilité */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Header */
.header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px 0 rgba(2, 132, 199, 0.1), 0 1px 2px 0 rgba(2, 132, 199, 0.06);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

.logo:hover {
    color: var(--primary-dark);
    transform: scale(1.05);
}

.logo-icon {
    font-size: 2rem;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.welcome {
    color: var(--text-primary); /* Contraste amélioré */
    font-weight: 600; /* Plus gras */
    font-size: 0.95rem; /* Légèrement plus grand */
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem; /* Padding augmenté pour meilleure accessibilité */
    border: none;
    border-radius: var(--radius);
    font-weight: 600; /* Plus gras pour meilleure visibilité */
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem; /* Taille augmentée pour meilleure lisibilité */
    min-height: 44px; /* Taille minimale pour accessibilité tactile */
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3), 0 2px 4px rgba(2, 132, 199, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(2, 132, 199, 0.4), 0 4px 8px rgba(2, 132, 199, 0.3);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 2px solid var(--border-strong); /* Bordure plus épaisse et visible */
    font-weight: 600; /* Texte plus gras pour meilleure visibilité */
}

.btn-secondary:hover {
    background: var(--background-alt);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.625rem 1.25rem; /* Padding légèrement augmenté */
    font-size: 0.875rem; /* Taille augmentée pour meilleure lisibilité */
    font-weight: 600; /* Plus gras */
    min-height: 40px; /* Taille minimale pour accessibilité */
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-full {
    width: 100%;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.85) 0%, rgba(67, 56, 202, 0.8) 50%, rgba(99, 102, 241, 0.75) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-xl);
    margin: 2rem 0;
    box-shadow: 0 25px 50px rgba(67, 56, 202, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 20%, rgba(139, 92, 246, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(99, 102, 241, 0.25) 0%, transparent 50%);
    z-index: 0;
    animation: subtleGlow 8s ease-in-out infinite alternate;
}

@keyframes subtleGlow {
    0% {
        opacity: 0.8;
    }
    100% {
        opacity: 1;
    }
}

.hero-section > * {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: #ffffff; /* Blanc très clair */
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    color: #ffffff; /* Blanc très clair */
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 0 15px rgba(0, 0, 0, 0.2);
    opacity: 1;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Style pour le bouton "Trouver un médecin" dans la hero section */
.hero-actions .btn-primary,
.hero-actions button.btn-primary {
    background: #6b7280 !important; /* Gris pour le background */
    color: #ffffff !important; /* Blanc très clair pour le texte */
    font-weight: 700 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
    border: none !important;
}

.hero-actions .btn-primary:hover,
.hero-actions button.btn-primary:hover {
    background: #4b5563 !important; /* Gris foncé au hover */
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4) !important;
}

/* Features Section */
.features-section {
    padding: 4rem 2rem;
    background: var(--surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    margin: 2rem 0;
    border: 2px solid var(--border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(13, 148, 136, 0.1);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    border: 2px solid var(--border);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.feature-description {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 1rem;
    font-weight: 400;
}

/* Forms */
.form-container {
    max-width: 650px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.form-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-subtitle {
    color: var(--text-secondary);
}

.form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600; /* Plus gras pour meilleure visibilité */
    color: var(--text-primary);
    font-size: 0.95rem; /* Légèrement plus grand */
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.875rem; /* Plus de padding pour meilleure lisibilité */
    border: 2px solid var(--border-strong); /* Bordure plus visible */
    border-radius: var(--radius);
    font-size: 1rem; /* Taille de base maintenue */
    transition: var(--transition);
    background: white;
    color: var(--text-primary);
    font-weight: 500; /* Texte légèrement plus gras */
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    border-width: 3px; /* Bordure plus épaisse au focus */
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.15); /* Ombre plus visible */
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-footer {
    text-align: center;
    margin-top: 1rem;
}

.form-footer p {
    color: var(--text-secondary);
}

/* Doctors Page */
.doctors-page {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.search-section {
    background: var(--background);
    padding: 2rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.doctors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.doctor-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 2px solid var(--border); /* Bordure plus épaisse */
}

.doctor-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.doctor-info h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.doctor-info .specialty {
    color: var(--primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.doctor-info .location {
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 500; /* Plus visible */
}

.doctor-info .address {
    color: var(--text-secondary); /* Contraste amélioré */
    font-size: 0.95rem; /* Légèrement plus grand */
    font-weight: 400;
}

.doctor-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-close:hover {
    background: var(--background);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Slots Grid */
.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.slot-btn {
    padding: 0.75rem;
    border: 2px solid var(--border);
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.slot-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.slot-btn.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.alert-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.no-results {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Mobile */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .doctors-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .slots-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.doctor-card,
.feature-card,
.form-container {
    animation: fadeIn 0.6s ease-out;
}

/* Loading Spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.loading-spinner.large {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    gap: 1rem;
}

/* Fix pour centrer le modal de RDV */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1000 !important;
    padding: 1rem !important;
}

.modal {
    background: white !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    max-width: 500px !important;
    width: 100% !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    position: relative !important;
}

/* Bouton profil médecin sur la carte */
.doctor-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-profile {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

.btn-profile:hover {
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
}

/* Fix pour centrer le modal de RDV */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1000 !important;
    padding: 1rem !important;
}

.modal {
    background: white !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    max-width: 500px !important;
    width: 100% !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    position: relative !important;
}

/* Bouton profil médecin sur la carte */
.doctor-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-profile {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

.btn-profile:hover {
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
}

/* ========== MODALES MODERNES ========== */
.custom-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(4px);
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 10000 !important;
    animation: fadeIn 0.3s ease;
    padding: 20px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    /* S'assurer que la modal reste centrée dans le viewport */
    margin: 0 !important;
    /* Empêcher tout positionnement relatif */
    transform: none !important;
    /* Scroll fluide */
    scroll-behavior: smooth !important;
    /* Forcer le centrage vertical même si le contenu est long */
    min-height: 100vh !important;
}

.custom-modal {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    animation: slideUp 0.3s ease;
    margin: auto !important;
    /* Position relative pour permettre le centrage */
    position: relative !important;
    /* S'assurer que la modal reste visible dans le viewport */
    top: auto !important;
    left: auto !important;
    transform: none !important;
    align-self: center !important;
    /* Scroll fluide */
    scroll-behavior: smooth !important;
    /* Forcer le centrage vertical même si le contenu est long */
    flex-shrink: 0 !important;
    /* S'assurer que la modal ne dépasse pas le viewport */
    min-height: auto !important;
    /* Display flex pour le contenu */
    display: flex !important;
    flex-direction: column !important;
}

/* Responsive pour mobile */
@media (max-width: 768px) {
    .custom-modal-overlay {
        padding: 10px;
        align-items: flex-start;
    }
    
    .custom-modal {
        width: 100%;
        max-width: 100%;
        max-height: calc(100vh - 20px);
        margin-top: 10px;
        border-radius: 12px;
    }
    
    .custom-modal-header {
        padding: 16px;
    }
    
    .custom-modal-body {
        padding: 16px;
    }
    
    .custom-modal-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
    }
    
    .custom-modal-footer button {
        flex: 1;
        min-width: 100px;
    }
}

.custom-modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.custom-modal-header h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0;
}

.custom-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: var(--transition);
}

.custom-modal-close:hover {
    color: var(--text-primary);
}

.custom-modal-body {
    padding: 24px;
}

.custom-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-message {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.modal-message-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 16px;
}

.modal-message-icon.success { color: var(--primary); }
.modal-message-icon.error { color: var(--danger); }
.modal-message-icon.warning { color: var(--warning); }
.modal-message-icon.info { color: var(--primary); }

.btn-secondary {
    padding: 10px 20px;
    background: var(--background);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-secondary:hover {
    background: var(--border);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ========== RESPONSIVE GLOBAL ========== */
@media (max-width: 768px) {
    /* Cartes de rendez-vous responsive */
    .appointments-list {
        padding: 0;
        grid-template-columns: 1fr !important;
    }
    
    .appointment-card {
        margin-bottom: 10px !important;
    }
    
    /* Header responsive */
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px;
    }
    
    .page-header h1 {
        font-size: 20px !important;
    }
    
    .page-header button {
        width: 100%;
    }
    
    /* Boutons en colonne sur très petit écran */
    @media (max-width: 480px) {
        .appointment-actions {
            flex-direction: column !important;
        }
        
        .appointment-actions button {
            width: 100% !important;
        }
    }
    
    /* Header responsive */
    .page-header {
        padding: 16px !important;
    }
    
    .page-header h1 {
        font-size: 1.5rem !important;
    }
    
    /* Liste des médecins */
    .doctors-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Formulaires */
    .form-group {
        margin-bottom: 16px;
    }
    
    /* Slots créneaux */
    .slots-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ==================== OPTIMISATIONS PERFORMANCE UX ==================== */

/* Toast notifications (rapides et élégantes) */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s;
    pointer-events: auto;
    border-left: 4px solid #1a73e8;
}

.toast.success {
    border-left-color: #0284c7;
}

.toast.error {
    border-left-color: #ea4335;
}

.toast.warning {
    border-left-color: #fbbc04;
}

.toast.info {
    border-left-color: #1a73e8;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #202124;
}

.toast-message {
    font-size: 13px;
    color: #5f6368;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(400px);
    }
}

/* Spinner de chargement inline */
.inline-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

.inline-spinner.dark {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: #1a73e8;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Overlay de chargement global */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99998;
    animation: fadeIn 0.2s ease;
}

.loading-overlay .spinner-large {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(26, 115, 232, 0.1);
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

.loading-overlay-text {
    font-size: 16px;
    color: #5f6368;
    font-weight: 500;
    margin-top: 12px;
}

.loading-overlay-subtext {
    font-size: 13px;
    color: #80868b;
    margin-top: 6px;
}

/* Skeleton loaders pour les cartes */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.skeleton-title {
    height: 20px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-text {
    height: 14px;
    width: 100%;
    margin-bottom: 8px;
}

.skeleton-text.short {
    width: 40%;
}

.skeleton-button {
    height: 40px;
    width: 120px;
    margin-top: 16px;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Boutons avec état de chargement amélioré */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Progress bar fine */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: #1a73e8;
    z-index: 99999;
    animation: progressAnimation 2s ease-in-out;
}

@keyframes progressAnimation {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Optimisation mobile des toasts et formulaires */
@media (max-width: 768px) {
    .toast-container {
        left: 10px;
        right: 10px;
        top: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
    }
    
    /* Formulaires responsive : 1 colonne sur mobile */
    .form-container {
        max-width: 100%;
        padding: 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* ========== MODALES MODERNES ET RESPONSIVES ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modern-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10000 !important;
    padding: 16px !important;
    overflow-y: auto !important;
    animation: fadeIn 0.2s ease-out !important;
    margin: 0 !important;
    /* S'assurer que le scroll commence au top */
    scroll-behavior: smooth !important;
}

.modern-modal-overlay::-webkit-scrollbar {
    width: 8px;
}

.modern-modal-overlay::-webkit-scrollbar-track {
    background: transparent;
}

.modern-modal-overlay::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.modern-modal-overlay::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.modern-modal {
    background: white !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
    max-width: 700px !important;
    width: 100% !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    position: relative !important;
    margin: auto !important;
    animation: slideUp 0.3s ease-out !important;
    display: flex !important;
    flex-direction: column !important;
    /* S'assurer que la modal est toujours visible */
    align-self: center !important;
    /* Empêcher le positionnement relatif qui cause des problèmes */
    top: auto !important;
    left: auto !important;
    transform: none !important;
}

.modern-modal::-webkit-scrollbar {
    width: 8px;
}

.modern-modal::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 0 16px 16px 0;
}

.modern-modal::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.modern-modal::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Header de modal moderne */
.modern-modal .custom-modal-header,
.custom-modal-header {
    padding: 24px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25) !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 50%, #06b6d4 100%) !important;
    border-radius: 16px 16px 0 0 !important;
    color: white !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3) !important;
}

.modern-modal .custom-modal-header h3,
.custom-modal-header h3 {
    margin: 0 !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    color: white !important;
}

.modern-modal .custom-modal-close,
.custom-modal-close {
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    color: white !important;
    font-size: 28px !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    line-height: 1 !important;
    padding: 0 !important;
}

.modern-modal .custom-modal-close:hover,
.custom-modal-close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.1) !important;
}

/* Body de modal moderne */
.modern-modal .custom-modal-body,
.custom-modal-body {
    padding: 24px !important;
    flex: 1 !important;
    overflow-y: auto !important;
}

/* Footer de modal moderne */
.modern-modal .custom-modal-footer,
.custom-modal-footer {
    padding: 20px 24px !important;
    border-top: 1px solid #e2e8f0 !important;
    display: flex !important;
    gap: 12px !important;
    justify-content: flex-end !important;
    background: #f8fafc !important;
    border-radius: 0 0 16px 16px !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 10 !important;
}

/* Responsive pour smartphones */
@media (max-width: 640px) {
    .modern-modal-overlay {
        padding: 0 !important;
        align-items: flex-end !important;
    }
    
    .modern-modal {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 95vh !important;
        border-radius: 20px 20px 0 0 !important;
        margin: 0 !important;
        animation: slideUp 0.3s ease-out !important;
    }
    
    .modern-modal .custom-modal-header,
    .custom-modal-header {
        border-radius: 20px 20px 0 0 !important;
        padding: 20px !important;
    }
    
    .modern-modal .custom-modal-header h3,
    .custom-modal-header h3 {
        font-size: 1.25rem !important;
    }
    
    .modern-modal .custom-modal-body,
    .custom-modal-body {
        padding: 20px !important;
    }
    
    .modern-modal .custom-modal-footer,
    .custom-modal-footer {
        padding: 16px 20px !important;
        flex-direction: column !important;
    }
    
    .modern-modal .custom-modal-footer button,
    .custom-modal-footer button {
        width: 100% !important;
    }
}

/* Responsive pour tablettes */
@media (min-width: 641px) and (max-width: 1024px) {
    .modern-modal {
        max-width: 600px !important;
    }
}

/* Responsive pour desktop */
@media (min-width: 1025px) {
    .modern-modal {
        max-width: 700px !important;
    }
}

/* Empêcher le scroll du body quand un modal est ouvert */
body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}
