/* Styles personnalisés modernes pour l'application web responsive */

:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --primary-light: #8b9ef7;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --success-dark: #059669;
    --danger-color: #ef4444;
    --danger-dark: #dc2626;
    --warning-color: #f59e0b;
    --warning-dark: #d97706;
    --info-color: #3b82f6;
    --info-dark: #2563eb;
    
    /* Couleurs de fond */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-dark: #1e293b;
    
    /* Couleurs de texte */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #ffffff;
    
    /* Ombres */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Bordures */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
}

/* Reset et base */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding-bottom: 2rem;
}

/* Navigation moderne avec gradient */
/* z-index : le menu déroulant « Catégorie » doit passer au-dessus du contenu (cartes du dashboard) */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
    box-shadow: var(--shadow-lg);
    padding: 0.6rem 0;
    min-height: 70px;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 2000;
}

.navbar .container-fluid {
    align-items: center;
    gap: 1rem;
    max-width: none;
    overflow: visible;
}

.navbar .navbar-collapse {
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    overflow: visible;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    transition: transform var(--transition-base);
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.navbar-brand img {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: transform var(--transition-base);
}

.navbar-brand:hover img {
    transform: rotate(5deg) scale(1.1);
}

/* Menu principal (gauche) : icône au-dessus du texte, alignement uniforme */
.navbar-nav.me-auto {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: flex-start;
    margin-left: 1rem;
    gap: 0.5rem;
}

.navbar-nav.me-auto .nav-item {
    display: flex;
}

.navbar-nav.me-auto .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 6.25rem;
    max-width: 8.5rem;
    padding: 0.5rem 0.75rem;
    gap: 0.35rem;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-base);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.navbar-nav.me-auto .nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left var(--transition-base);
}

.navbar-nav.me-auto .nav-link:hover::before {
    left: 0;
}

.navbar-nav.me-auto .nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.navbar-nav.me-auto .nav-link i {
    margin-right: 0;
    margin-bottom: 0;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Pastille rouge "questionnaires à répondre" : en haut à droite du lien */
.navbar-nav.me-auto .nav-link-with-badge {
    position: relative;
}
.nav-questionnaire-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.7rem;
    padding: 0.2em 0.5em;
    min-width: 1.25em;
    text-align: center;
}

/* Liens nav (dropdown utilisateur à droite) : garder alignement horizontal */
.navbar-nav:not(.me-auto) .nav-link {
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius-sm);
    margin: 0 0.25rem;
    transition: all var(--transition-base);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.navbar-nav:not(.me-auto) .nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left var(--transition-base);
}

.navbar-nav:not(.me-auto) .nav-link:hover::before {
    left: 0;
}

.navbar-nav:not(.me-auto) .nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.navbar-nav:not(.me-auto) .nav-link i {
    margin-right: 0.5rem;
    font-size: 1.1em;
}

.navbar-nav:not(.me-auto) {
    margin-left: auto;
    flex-shrink: 0;
}

/* Dropdown menu moderne */
.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-xl);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    margin-top: 0.5rem;
    background: var(--bg-primary);
}

.dropdown-item {
    border-radius: var(--border-radius-sm);
    padding: 0.75rem 1rem;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-light);
    transform: translateX(4px);
}

/* Cards modernes avec glassmorphism */
.card {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    background: var(--bg-primary);
    overflow: hidden;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.card:hover::before {
    opacity: 1;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 1.5rem;
}

/* Boutons modernes avec gradients */
.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    padding: 0.625rem 1.5rem;
    transition: all var(--transition-base);
    border: none;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--text-light);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--success-dark) 100%);
    color: var(--text-light);
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--success-dark) 0%, var(--success-color) 100%);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, var(--danger-dark) 100%);
    color: var(--text-light);
}

.btn-danger:hover {
    background: linear-gradient(135deg, var(--danger-dark) 0%, var(--danger-color) 100%);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, var(--warning-dark) 100%);
    color: var(--text-light);
}

.btn-warning:hover {
    background: linear-gradient(135deg, var(--warning-dark) 0%, var(--warning-color) 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: var(--text-light);
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--text-light);
    border-color: var(--primary-color);
}

/* Formulaires modernes */
.form-control, .form-select {
    border-radius: var(--border-radius-sm);
    border: 2px solid #e2e8f0;
    padding: 0.75rem 1rem;
    transition: all var(--transition-base);
    font-size: 1rem;
    background: var(--bg-primary);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Tables modernes */
.table {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    background: var(--bg-primary);
}

.table thead {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.table thead th {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border: none;
    padding: 1rem;
}

.table tbody tr {
    transition: all var(--transition-fast);
    border-bottom: 1px solid #f1f5f9;
}

.table tbody tr:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.05) 0%, transparent 100%);
    transform: scale(1.01);
}

.table td {
    padding: 1rem;
    vertical-align: middle;
}

/* Badges modernes */
.badge {
    padding: 0.5em 0.75em;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.bg-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%) !important;
}

.bg-success {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--success-dark) 100%) !important;
}

.bg-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, var(--danger-dark) 100%) !important;
}

.bg-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, var(--warning-dark) 100%) !important;
}

.bg-info {
    background: linear-gradient(135deg, var(--info-color) 0%, var(--info-dark) 100%) !important;
}

/* Badges spécifiques pour les statuts */
.badge.bg-en-cours {
    background: var(--success-color) !important; /* Vert */
    color: #ffffff;
}

.badge.bg-valide-envoye {
    background: #f97316 !important; /* Orange */
    color: #ffffff;
}

.badge.bg-validation-partielle {
    background: #fbbf24 !important; /* Jaune */
    color: #ffffff;
}

.badge.bg-valide-ca {
    background: var(--info-color) !important; /* Bleu */
    color: #ffffff;
}

.badge.bg-valide-all {
    background: var(--info-color) !important; /* Bleu */
    color: #ffffff;
}

.badge.bg-valide-dir {
    background: #1e293b !important; /* Noir */
    color: #ffffff;
}

/* Alerts modernes */
.alert {
    border-radius: var(--border-radius);
    border: none;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-sm);
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
    color: var(--success-dark);
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%);
    color: var(--danger-dark);
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.1) 100%);
    color: var(--warning-dark);
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.1) 100%);
    color: var(--info-dark);
    border-left: 4px solid var(--info-color);
}

/* Footer moderne */
footer {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: var(--text-light);
    margin-top: 4rem;
    padding: 2rem 0;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
}

footer small {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

/* Main container */
main {
    background: transparent;
}

.container-fluid {
    max-width: 1400px;
}

/* Titres modernes */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.75rem;
}

/* Sections de formulaire */
.form-section {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Menu contextuel moderne */
#ctxMenu {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.5rem;
    background: var(--bg-primary);
    backdrop-filter: blur(10px);
}

/* Scrollbar personnalisée moderne */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 10px;
    border: 2px solid var(--bg-tertiary);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary-color) 100%);
}

/* Focus amélioré */
:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
    border-radius: var(--border-radius-sm);
}

/* Animations fluides */
* {
    transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-base);
}

/* Responsive - Mobile */
@media (max-width: 576px) {
    body {
        font-size: 14px;
    }
    
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .form-section {
        padding: 1.25rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table td, .table th {
        padding: 0.75rem 0.5rem;
    }
    
    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .navbar-brand {
        font-size: 1.125rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        margin: 0.25rem 0;
    }
}

/* Responsive - Tablette */
@media (min-width: 577px) and (max-width: 992px) {
    .card-body {
        padding: 1.25rem;
    }
    
    .form-section {
        padding: 1.5rem;
    }
}

/* Touch targets pour mobile */
/* En dessous de lg, menu replié : lien en ligne (icône à gauche du texte) */
@media (max-width: 991.98px) {
    .navbar .navbar-collapse {
        justify-content: flex-start;
    }

    .navbar-nav.me-auto {
        flex-wrap: nowrap;
        margin-left: 0;
    }

    .navbar-nav.me-auto .nav-link {
        flex-direction: row;
        min-width: auto;
        max-width: none;
        text-align: left;
        justify-content: flex-start;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }
    .navbar-nav.me-auto .nav-link i {
        font-size: 1.1em;
    }
}

@media (max-width: 768px) {
    .btn, .nav-link, .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .navbar-toggler {
        padding: 0.5rem;
        border-radius: var(--border-radius-sm);
    }
}

/* Mode paysage mobile */
@media (max-width: 992px) and (orientation: landscape) {
    .navbar {
        padding: 0.5rem 0;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
}

/* Amélioration pour les grands écrans */
@media (min-width: 1400px) {
    .container-fluid {
        padding-left: 3rem;
        padding-right: 3rem;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Effets de glassmorphism pour certaines cartes */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Amélioration des modals */
.modal-content {
    border-radius: var(--border-radius-lg);
    border: none;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* Menu « Catégorie » : au-dessus de tout le contenu sous la barre (cartes, etc.) */
.navbar .nav-category-hover {
    position: relative;
    z-index: 2010;
}

.navbar .nav-category-hover .dropdown-menu {
    z-index: 2011;
}

/* Ouverture au survol (desktop) */
@media (min-width: 992px) {
    .nav-category-hover:hover > .dropdown-menu {
        display: block;
    }
    .nav-category-hover .dropdown-menu {
        margin-top: 0;
    }
}
