/* ========== VARIABLES ET RESET ========== */
:root {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --accent: #4cc9f0;
    --light: #f8f9fa;
    --dark: #212529;
    --success: #06d6a0;
    --warning: #ffd166;
    --danger: #ef476f;
    --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.2);
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: #f0f2f5;
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.container {
    max-width: 1200px;
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 2rem;
    box-shadow: var(--shadow);
    padding: 2rem;
    transition: all 0.3s ease;
}

/* ========== HEADER ========== */
.header {
    text-align: center;
    margin-bottom: 3rem;
}

.header h1 {
    font-size: 4rem;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
    position: relative;
    letter-spacing: -0.5px;
}

/* Effet glitch léger */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #ff00c1;
    animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: 2px 0 #00fff9;
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
    0% { clip-path: inset(20% 0 30% 0); }
    20% { clip-path: inset(60% 0 10% 0); }
    40% { clip-path: inset(30% 0 40% 0); }
    60% { clip-path: inset(80% 0 5% 0); }
    80% { clip-path: inset(10% 0 70% 0); }
    100% { clip-path: inset(40% 0 30% 0); }
}

@keyframes glitch-anim-2 {
    0% { clip-path: inset(50% 0 20% 0); }
    15% { clip-path: inset(10% 0 60% 0); }
    30% { clip-path: inset(80% 0 5% 0); }
    45% { clip-path: inset(30% 0 40% 0); }
    60% { clip-path: inset(70% 0 10% 0); }
    75% { clip-path: inset(5% 0 80% 0); }
    90% { clip-path: inset(40% 0 30% 0); }
    100% { clip-path: inset(60% 0 20% 0); }
}

.slogan {
    font-size: 1.3rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

/* ========== STATISTIQUES ========== */
.stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    flex: 1 1 200px;
    background: white;
    border-radius: 1.5rem;
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.6s ease backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }

.stat-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.stat-card i {
    font-size: 2.5rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 1rem;
}

.stat-number {
    display: block;
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.2;
}

.stat-label {
    font-size: 1.1rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ========== ACTIONS ========== */
.actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.action-card {
    background: white;
    border-radius: 1.5rem;
    padding: 2rem 1.5rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid rgba(0,0,0,0.02);
    animation: fadeInUp 0.6s ease backwards;
}

.action-card:nth-child(1) { animation-delay: 0.2s; }
.action-card:nth-child(2) { animation-delay: 0.3s; }
.action-card:nth-child(3) { animation-delay: 0.4s; }
.action-card:nth-child(4) { animation-delay: 0.5s; }

.action-card:hover {
    transform: scale(1.03) translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.action-card i {
    font-size: 3rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 1rem;
}

.action-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.action-card p {
    color: #6c757d;
    font-size: 0.95rem;
}

/* ========== FOOTER (MENTION) ========== */
.footer {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    border-left: 4px solid var(--warning);
    box-shadow: var(--shadow);
    animation: fadeIn 0.8s ease;
}

.footer p {
    color: #495057;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.footer i {
    color: var(--warning);
    font-size: 1.2rem;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .header h1 {
        font-size: 3rem;
    }
    .stat-number {
        font-size: 2.2rem;
    }
    .action-card {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
    }
    /* Statistiques sur une seule ligne */
    .stats {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }
    .stat-card {
        flex: 1 1 0;
        padding: 1rem 0.5rem;
    }
    .stat-card i {
        font-size: 1.8rem;
        margin-bottom: 0.3rem;
    }
    .stat-number {
        font-size: 1.5rem;
    }
    .stat-label {
        font-size: 0.7rem;
        letter-spacing: 0.5px;
    }
    .actions {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .action-card {
        padding: 1.2rem;
    }
    .action-card i {
        font-size: 2.2rem;
    }
    .action-card h3 {
        font-size: 1.2rem;
    }
    .action-card p {
        font-size: 0.85rem;
    }
    .footer p {
        font-size: 0.8rem;
    }
}

/* ========== TOP BAR & DROPDOWN ========== */
.top-bar {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

.menu-toggle {
    background: var(--gradient);
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.menu-toggle:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-hover);
}

.menu-toggle:active {
    transform: scale(0.95);
}

.dropdown-menu {
    position: absolute;
    top: 60px;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    z-index: 1001;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-content {
    padding: 0.5rem;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--dark);
    text-decoration: none;
    transition: background 0.2s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    font-size: 1rem;
    font-family: inherit;
}

.dropdown-item i {
    width: 20px;
    color: var(--primary);
}

.dropdown-item:hover {
    background: #f1f3f5;
}

.dropdown-item.logout {
    color: var(--danger);
}

.dropdown-item.logout i {
    color: var(--danger);
}

.dropdown-divider {
    height: 1px;
    background: #e9ecef;
    margin: 0.5rem 0;
}

.user-info {
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--primary);
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 0.5rem;
}

/* Overlay pour fermer le menu en cliquant à l'extérieur */
.dropdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    display: none;
}

.dropdown-overlay.show {
    display: block;
}

/* ========== MODALES ========== */
.modal, .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.3s, opacity 0.3s;
    z-index: 2000;
}

.modal-overlay {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2001;
}

.modal {
    z-index: 2002;
    padding: 1rem;
    box-sizing: border-box;
    overflow-y: auto; /* Permet le défilement global si nécessaire */
}

.modal.show, .modal-overlay.show {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background: white;
    max-width: 500px;
    width: 100%;
    max-height: 90vh; /* Ne dépasse pas 90% de l'écran */
    border-radius: 2rem;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
    overflow-y: auto; /* Défilement interne */
    animation: modalPop 0.4s ease;
    display: flex;
    flex-direction: column;
}

@keyframes modalPop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-header {
    background: var(--gradient);
    color: white;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.2rem;
    flex-shrink: 0; /* Empêche l'en-tête de rétrécir */
}

.modal-header i {
    font-size: 2rem;
}

.modal-body {
    padding: 2rem 1.5rem;
    color: var(--dark);
    line-height: 1.6;
    overflow-y: auto; /* Défilement du corps */
    flex: 1; /* Prend tout l'espace disponible */
}

.modal-body p {
    margin-bottom: 1rem;
}

.modal-signature {
    font-style: italic;
    text-align: right;
    color: #6c757d;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.modal-footer {
    padding: 1rem 1.5rem 2rem;
    text-align: center;
    flex-shrink: 0;
}

.modal-btn {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.modal-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.modal-btn:active {
    transform: translateY(0);
}

/* Responsive pour mobile */
@media (max-width: 480px) {
    .modal-content {
        max-width: 95%;
        max-height: 85vh;
        border-radius: 1.5rem;
    }
    
    .modal-header {
        padding: 1rem;
        font-size: 1rem;
    }
    
    .modal-header i {
        font-size: 1.5rem;
    }
    
    .modal-body {
        padding: 1.2rem 1rem;
    }
    
    .modal-footer {
        padding: 0.8rem 1rem 1.5rem;
    }
    
    .modal-btn {
        padding: 0.7rem 1.5rem;
        font-size: 1rem;
    }
}