﻿/* ═══════════════════════════════════════════════════════════
   DASHBOARD NAVIGATION OVERLAY - RESPONSIVE
   ═══════════════════════════════════════════════════════ */

.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 119, 182, 0.98), rgba(0, 180, 216, 0.96));
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    overflow-y: auto;
    padding: 20px;
}

.nav-close {
    position: fixed;
    top: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-decoration: none;
    cursor: pointer;
    z-index: 3001;
}

    .nav-close:hover {
        background: rgba(255, 255, 255, 0.3);
        transform: scale(1.1) rotate(90deg);
    }

    .nav-close svg {
        width: 24px;
        height: 24px;
        stroke: white;
        stroke-width: 2.5;
    }

.nav-logo {
    margin-bottom: 50px;
    text-align: center;
}

    .nav-logo img {
        max-height: 120px;
        filter: brightness(0) invert(1);
        max-width: 90vw;
    }

.nav-logo-text {
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 1200px;
    width: 100%;
}

/* ═══════════════════════════════════════════════════════════
   BOUTONS DE NAVIGATION
   ═══════════════════════════════════════════════════════ */

/* Wrapper pour les boutons avec dropdown */
.nav-btn-dropdown {
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Style uniforme pour TOUS les boutons */
.nav-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 30px 40px;
    color: white;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
    width: 100%;
    height: 100%;
    min-height: 150px;
}

    .nav-btn:hover {
        background: rgba(255, 255, 255, 0.25);
        border-color: rgba(255, 255, 255, 0.5);
        transform: translateY(-5px);
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    }

.nav-btn-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .nav-btn-icon svg {
        width: 28px;
        height: 28px;
        stroke: white;
        stroke-width: 2;
    }

.nav-btn-text {
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
}

/* ═══════════════════════════════════════════════════════════
   QUICK ACTIONS (DESKTOP)
   ═══════════════════════════════════════════════════════ */

.nav-quick-actions {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 8px;
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 3001;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.nav-btn-dropdown:hover .nav-quick-actions {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.nav-quick-action-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #0077b6;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
}

    .nav-quick-action-item:hover {
        background: rgba(0, 119, 182, 0.1);
        color: #005a8d;
    }

    .nav-quick-action-item svg {
        width: 20px;
        height: 20px;
        stroke: currentColor;
        stroke-width: 2;
        flex-shrink: 0;
    }

/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════ */

.nav-footer {
    margin-top: 50px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    text-align: center;
}

    .nav-footer strong {
        color: rgba(255, 255, 255, 0.8);
    }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE - TABLET (768px - 1024px)
   ═══════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .nav-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
        padding: 0 20px;
    }

    .nav-btn {
        padding: 25px 30px;
        min-height: 140px;
    }

    .nav-btn-text {
        font-size: 0.95rem;
    }

    .nav-logo img {
        max-height: 100px;
    }

    .nav-logo-text {
        font-size: 2rem;
    }

    /* Quick actions en mode tablette */
    .nav-quick-actions {
        min-width: 200px;
    }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE - MOBILE (max-width: 768px)
   ═══════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .nav-overlay {
        justify-content: flex-start;
        padding: 80px 15px 30px;
    }

    .nav-close {
        top: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }

        .nav-close svg {
            width: 20px;
            height: 20px;
        }

    .nav-logo {
        margin-bottom: 30px;
    }

        .nav-logo img {
            max-height: 80px;
        }

    .nav-logo-text {
        font-size: 1.5rem;
    }

    .nav-grid {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
        padding: 0;
    }

    /* ✅ CORRECTION : Wrapper prend toute la cellule de la grid */
    .nav-btn-dropdown {
        display: contents; /* Les enfants deviennent des grid items directs */
    }

    .nav-btn {
        padding: 20px 15px;
        min-height: 120px;
        gap: 10px;
        grid-column: auto; /* Prend 1 colonne */
    }

    .nav-btn-icon {
        width: 40px;
        height: 40px;
    }

        .nav-btn-icon svg {
            width: 22px;
            height: 22px;
        }

    .nav-btn-text {
        font-size: 0.85rem;
    }

    /* Quick actions en mode mobile - Affichage en dessous dans la grid */
    .nav-quick-actions {
        position: static;
        left: auto;
        transform: none;
        margin: 0;
        width: 100%;
        opacity: 0;
        visibility: hidden;
        max-height: 0;
        overflow: hidden;
        transition: all 0.3s ease;
        padding: 0;
        grid-column: 1 / -1; /* ✅ Prend toute la largeur de la grid */
        order: 999; /* ✅ Force l'affichage en dessous */
    }

    /* ✅ Toggle des quick actions au clic */
    .nav-btn-dropdown:has(.nav-btn:active) .nav-quick-actions,
    .nav-btn-dropdown:has(.nav-btn:focus) .nav-quick-actions,
    .nav-btn-dropdown.active .nav-quick-actions {
        opacity: 1;
        visibility: visible;
        max-height: 500px;
        padding: 8px;
        margin-top: -5px;
    }

    .nav-quick-action-item {
        padding: 10px 12px;
        font-size: 13px;
    }

        .nav-quick-action-item svg {
            width: 18px;
            height: 18px;
        }

    .nav-footer {
        margin-top: 30px;
        font-size: 0.8rem;
        padding: 0 15px;
    }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE - SMALL MOBILE (max-width: 480px)
   ═══════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .nav-overlay {
        padding: 70px 10px 20px;
    }

    .nav-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
    }

    .nav-logo {
        margin-bottom: 25px;
    }

        .nav-logo img {
            max-height: 60px;
        }

    .nav-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* ✅ CORRECTION : display: contents pour small mobile aussi */
    .nav-btn-dropdown {
        display: contents;
    }

    .nav-btn {
        padding: 18px 15px;
        min-height: 100px;
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
        grid-column: 1; /* Une seule colonne */
    }

    .nav-btn-icon {
        width: 35px;
        height: 35px;
    }

        .nav-btn-icon svg {
            width: 20px;
            height: 20px;
        }

    .nav-btn-text {
        font-size: 0.9rem;
        text-align: left;
        flex: 1;
    }

    .nav-quick-actions {
        grid-column: 1; /* Une seule colonne */
        margin-top: 0;
    }

    .nav-quick-action-item {
        padding: 10px;
        font-size: 13px;
    }

    .nav-footer {
        margin-top: 20px;
        font-size: 0.75rem;
    }
}

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS ET TRANSITIONS
   ═══════════════════════════════════════════════════════ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-overlay {
    animation: fadeIn 0.3s ease-out;
}

.nav-btn {
    animation: fadeIn 0.5s ease-out backwards;
}

    .nav-btn:nth-child(1) {
        animation-delay: 0.05s;
    }

    .nav-btn:nth-child(2) {
        animation-delay: 0.1s;
    }

    .nav-btn:nth-child(3) {
        animation-delay: 0.15s;
    }

    .nav-btn:nth-child(4) {
        animation-delay: 0.2s;
    }

    .nav-btn:nth-child(5) {
        animation-delay: 0.25s;
    }

    .nav-btn:nth-child(6) {
        animation-delay: 0.3s;
    }

/* ═══════════════════════════════════════════════════════════
   TOUCH DEVICE OPTIMIZATIONS
   ═══════════════════════════════════════════════════════ */

@media (hover: none) and (pointer: coarse) {
    /* Amélioration pour appareils tactiles */
    .nav-btn {
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
        touch-action: manipulation;
    }

        .nav-btn:active {
            transform: scale(0.97);
        }

    .nav-quick-action-item:active {
        background: rgba(0, 119, 182, 0.15);
    }

    /* ✅ Toggle class via JavaScript recommandé */
    .nav-btn-dropdown {
        -webkit-tap-highlight-color: transparent;
    }
}

/* ═══════════════════════════════════════════════════════════
   LANDSCAPE MODE (MOBILE)
   ═══════════════════════════════════════════════════════ */

@media (max-width: 768px) and (orientation: landscape) {
    .nav-overlay {
        padding: 60px 15px 20px;
    }

    .nav-logo {
        margin-bottom: 20px;
    }

        .nav-logo img {
            max-height: 60px;
        }

    .nav-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .nav-btn {
        min-height: 100px;
        padding: 15px;
    }

    .nav-footer {
        margin-top: 20px;
    }
}

/* ═══════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════ */

@media print {
    .nav-overlay {
        display: none;
    }
}
