/* Importer une police moderne et lisible depuis Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --- Variables de Couleur et Style Racine --- */
:root {
    --primary-blue: #1e3a8a; /* Indigo 900 - Pour les titres, sidebar */
    --secondary-blue: #3b82f6; /* Blue 500 - Pour les boutons, liens */
    --accent-green: #10b981; /* Emerald 500 - Pour la croissance, succès */
    --bg-light: #f8fafc; /* Slate 50 - Pour les fonds de page */
    --card-bg: #ffffff;
    --text-primary: #1e293b; /* Slate 800 */
    --text-secondary: #64748b; /* Slate 500 */
    --border-color: #e2e8f0; /* Slate 200 */
}

/* --- Styles Globaux et Typographie --- */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
}

/* Gradients subtils */
.gradient-primary {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #3730a3 100%);
}
.gradient-card {
    background: linear-gradient(145deg, #ffffff 0%, #f1f5f9 100%);
}

/* Ombres élégantes */
.shadow-elegant {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.shadow-hover {
    transition: box-shadow 0.3s ease-in-out;
}
.shadow-hover:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Animations fluides */
.transition-all {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Personnalisation des Composants --- */

/* Sidebar */
.sidebar-custom {
    background: linear-gradient(180deg, var(--primary-blue) 0%, #1e40af 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-custom .nav-link {
    color: rgba(255, 255, 255, 0.85);
    transition: all 0.2s ease-in-out;
    position: relative;
}
.sidebar-custom .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    transform: translateX(2px);
}
.sidebar-custom .nav-link.bg-white {
    background-color: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.sidebar-custom .nav-link.bg-white i {
    color: #ffffff !important;
}
.sidebar-custom .nav-link.border-l-4 {
    border-left-width: 4px;
    border-left-color: rgba(255, 255, 255, 1) !important;
}
.sidebar-custom .nav-link i {
    width: 20px;
    text-align: center;
    transition: all 0.2s;
}
.sidebar-custom .nav-link:hover i {
    transform: scale(1.1);
}

/* Styles pour sidebar repliée */
.sidebar-collapsed .nav-link.bg-white {
    background-color: rgba(255, 255, 255, 0.35) !important;
    border-left: 4px solid rgba(255, 255, 255, 1) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.sidebar-collapsed .nav-link.bg-white i {
    color: #ffffff !important;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.5));
}

/* Tooltip pour sidebar repliée */
.sidebar-custom .nav-link .tooltip {
    position: absolute;
    left: 100%;
    margin-left: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: #1f2937;
    color: white;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 50;
    transition: opacity 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.sidebar-custom .nav-link:hover .tooltip {
    opacity: 1;
}

/* Avatar utilisateur */
.user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Cartes Statistiques */
.stat-card {
    @apply bg-white rounded-2xl shadow-elegant p-6 flex flex-col justify-between relative overflow-hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--secondary-blue), var(--accent-green));
}
.stat-card .stat-value {
    @apply text-3xl font-bold;
}
.stat-card .stat-label {
    @apply text-sm font-medium text-gray-500 uppercase tracking-wider;
}

/* Tableaux Modernes */
.modern-table {
    @apply bg-white rounded-2xl shadow-elegant overflow-hidden;
}
.modern-table thead {
    @apply bg-gray-50 border-b border-gray-200;
}
.modern-table thead th {
    @apply px-6 py-4 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider;
}
.modern-table tbody tr {
    @apply border-b border-gray-100 hover:bg-gray-50 transition-colors duration-150;
}
.modern-table tbody td {
    @apply px-6 py-4 whitespace-nowrap text-sm text-gray-700;
}

/* Boutons Premium */
.btn-primary {
    @apply bg-gradient-to-r from-blue-500 to-blue-600 text-white font-semibold py-2 px-4 rounded-lg shadow-md hover:from-blue-600 hover:to-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-all duration-300 transform hover:scale-105;
}
.btn-success {
    @apply bg-gradient-to-r from-emerald-500 to-emerald-600 text-white font-semibold py-2 px-4 rounded-lg shadow-md hover:from-emerald-600 hover:to-emerald-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-emerald-500 transition-all duration-300 transform hover:scale-105;
}

/* Formulaires */
.form-input {
    @apply w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200;
}

/* Animations pour les modals */
@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);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease-in-out;
}

/* === OPTIMISATIONS MOBILE === */
@media (max-width: 768px) {
    /* Réduire les espacements sur mobile */
    .space-y-8 > * + * {
        margin-top: 1rem !important;
    }
    
    .space-y-6 > * + * {
        margin-top: 0.75rem !important;
    }
    
    /* Titres plus compacts sur mobile */
    h1 {
        font-size: 1.5rem !important;
        line-height: 2rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
        line-height: 1.75rem !important;
    }
    
    /* Badges de quotas plus compacts */
    .bg-gradient-to-br {
        padding: 0.75rem !important;
    }
    
    /* Grid plus compact sur mobile */
    .grid.gap-4 {
        gap: 0.75rem !important;
    }
    
    /* Cartes d'actions rapides plus petites */
    .group.bg-white {
        padding: 0.75rem !important;
    }
    
    .group.bg-white i {
        font-size: 1.25rem !important;
    }
    
    .group.bg-white p {
        font-size: 0.875rem !important;
    }
    
    /* Boutons plus compacts */
    button {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
        font-size: 0.875rem !important;
    }
    
    /* Header plus compact */
    header .px-4 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    /* Contenu principal avec moins de padding */
    main .p-4 {
        padding: 0.75rem !important;
    }
    
    /* Tableaux responsive */
    .modern-table thead th,
    .modern-table tbody td {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.75rem !important;
    }
    
    /* Modals full screen sur mobile */
    .fixed.inset-0 > div:not(.bg-black) {
        margin: 0 !important;
        max-width: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
    }
    
    /* Sidebar overlay sur mobile */
    aside {
        z-index: 1000;
    }
    
    /* Formulaires responsive */
    .form-input {
        font-size: 16px !important; /* Évite le zoom iOS */
    }
    
    select {
        font-size: 16px !important; /* Évite le zoom iOS */
    }
    
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="tel"],
    textarea {
        font-size: 16px !important; /* Évite le zoom iOS */
    }
    
    /* Optimiser les badges de statut */
    .px-3.py-1 {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
    
    /* Icônes légèrement plus petites */
    .fa-2xl {
        font-size: 1.5rem !important;
    }
    
    .text-2xl {
        font-size: 1.25rem !important;
    }
    
    .text-3xl {
        font-size: 1.5rem !important;
    }
    
    .text-4xl {
        font-size: 1.75rem !important;
    }
    
    /* Optimiser les cartes de statistiques */
    .stat-card {
        padding: 1rem !important;
    }
    
    .stat-card .stat-value {
        font-size: 1.5rem !important;
    }
    
    /* Réduire les gap dans les flex */
    .gap-4 {
        gap: 0.75rem !important;
    }
    
    .gap-3 {
        gap: 0.5rem !important;
    }
    
    /* Actions rapides du dashboard */
    .grid.sm\\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Optimisations très petits écrans (< 375px) */
@media (max-width: 375px) {
    h1 {
        font-size: 1.25rem !important;
    }
    
    button span:not(.sm\\:inline) {
        font-size: 0.75rem !important;
    }
    
    .grid.sm\\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
}