/* ===== HEADER CSS - VERSION RESPONSIVE ULTIMATE ===== */

/* Variables CSS dynamiques pour responsive */
:root {
    --primary-blue: #1e5f8c;
    --secondary-green: #2E8B57;
    --accent-emerald: #10b981;
    --gold-accent: #f0c75e;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --border-light: #e2e8f0;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --gradient-main: linear-gradient(135deg, rgba(30, 95, 140, 0.95) 0%, rgba(46, 139, 87, 0.92) 50%, rgba(16, 185, 129, 0.95) 100%);
    
    /* Variables dynamiques pour responsive */
    --header-height: 70px;
    --logo-size: 40px;
    --font-title: 1.2rem;
    --font-slogan: 0.75rem;
    --font-nav: 0.7rem;
    --font-btn: 0.7rem;
    --nav-padding: 0.5rem 0.9rem;
    --btn-padding: 0.5rem 1rem;
    --container-padding: 1rem;
    --nav-gap: 0.4rem;
    --section-gap: 1rem;
}

/* ===== RESPONSIVE VARIABLES SELON TAILLE ÉCRAN ===== */

/* Extra Large Screens (> 1600px) */
@media (min-width: 1601px) {
    :root {
        --header-height: 80px;
        --logo-size: 45px;
        --font-title: 1.4rem;
        --font-slogan: 0.85rem;
        --font-nav: 0.75rem;
        --font-btn: 0.75rem;
        --nav-padding: 0.6rem 1.1rem;
        --btn-padding: 0.6rem 1.2rem;
        --container-padding: 2rem;
        --nav-gap: 0.6rem;
        --section-gap: 1.5rem;
    }
}

/* Large Screens (1200px - 1600px) */
@media (min-width: 1201px) and (max-width: 1600px) {
    :root {
        --header-height: 75px;
        --logo-size: 42px;
        --font-title: 1.3rem;
        --font-slogan: 0.8rem;
        --font-nav: 0.72rem;
        --font-btn: 0.72rem;
        --nav-padding: 0.55rem 1rem;
        --btn-padding: 0.55rem 1.1rem;
        --container-padding: 1.5rem;
        --nav-gap: 0.5rem;
        --section-gap: 1.2rem;
    }
}

/* Medium-Large Screens (1024px - 1200px) */
@media (min-width: 1025px) and (max-width: 1200px) {
    :root {
        --header-height: 70px;
        --logo-size: 38px;
        --font-title: 1.15rem;
        --font-slogan: 0.72rem;
        --font-nav: 0.65rem;
        --font-btn: 0.65rem;
        --nav-padding: 0.45rem 0.8rem;
        --btn-padding: 0.45rem 0.9rem;
        --container-padding: 1.2rem;
        --nav-gap: 0.35rem;
        --section-gap: 1rem;
    }
}

/* Medium Screens - Tablet Landscape (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        --header-height: 65px;
        --logo-size: 36px;
        --font-title: 1.05rem;
        --font-slogan: 0.68rem;
        --font-nav: 0.6rem;
        --font-btn: 0.6rem;
        --nav-padding: 0.4rem 0.7rem;
        --btn-padding: 0.4rem 0.8rem;
        --container-padding: 1rem;
        --nav-gap: 0.25rem;
        --section-gap: 0.8rem;
    }
}

/* Small-Medium Screens - Tablet Portrait (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    :root {
        --header-height: 60px;
        --logo-size: 34px;
        --font-title: 1rem;
        --font-slogan: 0.65rem;
        --font-btn: 0.65rem;
        --btn-padding: 0.4rem 0.8rem;
        --container-padding: 0.8rem;
        --section-gap: 0.6rem;
    }
}

/* Small Screens - Mobile (321px - 480px) */
@media (min-width: 321px) and (max-width: 480px) {
    :root {
        --header-height: 55px;
        --logo-size: 32px;
        --font-title: 0.95rem;
        --font-slogan: 0.6rem;
        --font-btn: 0.6rem;
        --btn-padding: 0.35rem 0.7rem;
        --container-padding: 0.6rem;
        --section-gap: 0.5rem;
    }
}

/* Extra Small Screens (≤ 320px) */
@media (max-width: 320px) {
    :root {
        --header-height: 50px;
        --logo-size: 28px;
        --font-title: 0.85rem;
        --font-slogan: 0.55rem;
        --font-btn: 0.55rem;
        --btn-padding: 0.3rem 0.6rem;
        --container-padding: 0.5rem;
        --section-gap: 0.4rem;
    }
}

/* ===== RESET ET BASE ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-padding-top: var(--header-height);
}

body {
    margin-top: var(--header-height);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

/* ===== HEADER PRINCIPAL ===== */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--header-height);
    background: var(--gradient-main);
    backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 
        0 4px 16px var(--shadow-light),
        0 1px 4px rgba(30, 95, 140, 0.2);
    border-bottom: 1px solid rgba(240, 199, 94, 0.3);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    align-items: center;
}

/* Container responsif avec CSS Grid */
.header-container {
    width: 100%;
    max-width: 100vw;
    margin: 0 auto;
    padding: 0 var(--container-padding);
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "logo nav user";
    align-items: center;
    gap: var(--section-gap);
    height: 100%;
    min-height: var(--header-height);
}

/* Responsive Grid Layout pour différentes tailles */
@media (min-width: 1201px) {
    .header-container {
        grid-template-columns: minmax(200px, auto) 1fr minmax(150px, auto);
        max-width: 1800px;
    }
}

@media (min-width: 1025px) and (max-width: 1200px) {
    .header-container {
        grid-template-columns: minmax(180px, auto) 1fr minmax(140px, auto);
        max-width: 1200px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .header-container {
        grid-template-columns: minmax(160px, auto) 1fr minmax(120px, auto);
        max-width: 1024px;
    }
}

@media (max-width: 768px) {
    .header-container {
        grid-template-columns: 1fr auto auto;
        grid-template-areas: "logo toggle user";
        gap: var(--section-gap);
        max-width: 100%;
    }
}

/* ===== LOGO SECTION RESPONSIVE ===== */
.logo-section {
    grid-area: logo;
    display: flex;
    align-items: center;
    gap: calc(var(--section-gap) * 0.7);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 0; /* Permet la contraction */
}

.logo-section:hover {
    transform: scale(1.02) translateY(-1px);
}

.logo {
    width: var(--logo-size);
    height: var(--logo-size);
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(240, 199, 94, 0.6);
    transition: all 0.4s ease;
    flex-shrink: 0;
    box-shadow: 
        0 2px 8px var(--shadow-light),
        0 0 0 1px rgba(240, 199, 94, 0.1);
}

.logo:hover {
    border-color: var(--gold-accent);
    transform: scale(1.1);
    box-shadow: 
        0 4px 12px var(--shadow-medium),
        0 0 0 2px rgba(240, 199, 94, 0.2),
        0 0 12px rgba(240, 199, 94, 0.3);
}

.site-title {
    min-width: 0; /* Permet l'ellipsis */
    overflow: hidden;
}

.site-title h1 {
    font-family: 'Playfair Display', serif;
    font-size: var(--font-title);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-title .slogan {
    font-family: 'Cormorant Garamond', serif;
    font-size: var(--font-slogan);
    font-style: italic;
    color: rgba(240, 199, 94, 0.9);
    margin: 0;
    font-weight: 400;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Masquer le slogan sur très petits écrans */
@media (max-width: 420px) {
    .site-title .slogan {
        display: none;
    }
}

/* ===== NAVIGATION DESKTOP RESPONSIVE ===== */
@media (min-width: 769px) {
    .mobile-toggle {
        display: none !important;
    }
    
    .main-nav {
        grid-area: nav;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: var(--nav-gap);
        margin: 0;
        padding: 0;
        overflow-x: auto;
        overflow-y: visible;
        scrollbar-width: thin;
        scrollbar-color: rgba(240, 199, 94, 0.6) transparent;
        mask-image: linear-gradient(
            to right,
            transparent 0px,
            black 20px,
            black calc(100% - 20px),
            transparent 100%
        );
        -webkit-mask-image: linear-gradient(
            to right,
            transparent 0px,
            black 20px,
            black calc(100% - 20px),
            transparent 100%
        );
    }
    
    /* Style de la scrollbar */
    .main-nav::-webkit-scrollbar {
        height: 2px;
    }
    
    .main-nav::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 1px;
    }
    
    .main-nav::-webkit-scrollbar-thumb {
        background: rgba(240, 199, 94, 0.6);
        border-radius: 1px;
    }
    
    .main-nav::-webkit-scrollbar-thumb:hover {
        background: rgba(240, 199, 94, 0.8);
    }
    
    .nav-container {
        display: contents !important;
    }
    
    .mobile-nav-header,
    .mobile-nav-footer,
    .mobile-nav-close {
        display: none !important;
    }
    
    .main-nav a {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: var(--nav-padding) !important;
        background: rgba(255, 255, 255, 0.12) !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        border-radius: 18px !important;
        color: white !important;
        font-size: var(--font-nav) !important;
        font-weight: 500 !important;
        text-transform: uppercase !important;
        text-decoration: none !important;
        letter-spacing: 0.3px !important;
        transition: all 0.25s ease !important;
        backdrop-filter: blur(8px) !important;
        position: relative !important;
        overflow: hidden !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        line-height: 1.2 !important;
    min-width: fit-content !important;
}

.auth-btn:hover {
    background: linear-gradient(135deg, 
        rgba(240, 199, 94, 0.8), 
        rgba(16, 185, 129, 0.8)) !important;
    border-color: rgba(240, 199, 94, 0.6) !important;
    transform: translateY(-1px) scale(1.02) !important;
    box-shadow: 0 3px 8px rgba(240, 199, 94, 0.3) !important;
}

.user-btn {
    background: linear-gradient(135deg, var(--accent-emerald), #059669) !important;
    border: none !important;
    padding: var(--btn-padding) !important;
    border-radius: 16px !important;
    color: white !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.25s ease !important;
    position: relative !important;
    overflow: hidden !important;
    text-transform: uppercase !important;
    letter-spacing: 0.2px !important;
    font-size: var(--font-btn) !important;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
    min-width: fit-content !important;
}

.user-btn:hover {
    background: linear-gradient(135deg, #059669, #047857) !important;
    transform: translateY(-1px) scale(1.03) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

/* Responsive pour les boutons utilisateur */
@media (max-width: 480px) {
    .user-section {
        gap: calc(var(--section-gap) * 0.4);
    }
    
    .auth-btn,
    .user-btn {
        padding: calc(var(--btn-padding) * 0.8) !important;
        font-size: calc(var(--font-btn) * 0.9) !important;
        gap: 0.2rem !important;
    }
    
    /* Masquer le texte des boutons sur très petits écrans, garder seulement les icônes */
    .auth-btn span:not(.fas):not(.fa),
    .user-btn span:not(.fas):not(.fa) {
        display: none;
    }
}

@media (max-width: 320px) {
    .auth-btn,
    .user-btn {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.5rem !important;
        border-radius: 12px !important;
    }
}

/* Dropdown utilisateur responsive */
.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 10px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
    min-width: 160px;
    padding: 0.4rem 0;
    display: none;
    z-index: 1002;
    transform: scale(0.95) translateY(-10px);
    opacity: 0;
    transition: all 0.2s ease;
}

.user-dropdown.show {
    display: block;
    transform: scale(1) translateY(0);
    opacity: 1;
}

.user-dropdown a,
.user-dropdown button {
    display: block;
    width: 100%;
    padding: 0.5rem 0.8rem;
    color: var(--text-dark);
    text-decoration: none;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: calc(var(--font-btn) * 0.9);
    line-height: 1.3;
    white-space: nowrap;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
    background: linear-gradient(135deg, 
        rgba(30, 95, 140, 0.08), 
        rgba(16, 185, 129, 0.08));
    color: var(--primary-blue);
    transform: translateX(3px);
}

@media (max-width: 768px) {
    .user-dropdown {
        right: -0.5rem;
        min-width: 140px;
    }
}

/* ===== MODALES D'AUTHENTIFICATION RESPONSIVES ===== */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh; /* Support des viewports dynamiques */
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    padding: 1rem;
    overflow-y: auto;
}

.auth-modal.show {
    display: flex;
    opacity: 1;
}

.auth-modal-content {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    width: 100%;
    max-width: min(90vw, 420px);
    max-height: min(90vh, 90dvh);
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    position: relative;
    transform: scale(0.8) translateY(30px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin: auto;
}

.auth-modal.show .auth-modal-content {
    transform: scale(1) translateY(0);
}

.close-modal {
    position: absolute;
    top: 12px;
    right: 15px;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.close-modal:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    transform: scale(1.1) rotate(90deg);
}

.auth-modal-header {
    padding: 1.8rem 1.3rem 0.8rem;
    text-align: center;
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    position: relative;
}

.auth-modal-header h2 {
    color: var(--primary-blue);
    margin-bottom: 0.4rem;
    font-size: calc(var(--font-title) + 0.2rem);
    font-family: 'Playfair Display', serif;
    line-height: 1.3;
}

.auth-modal-header p {
    color: var(--text-muted);
    margin: 0;
    font-size: calc(var(--font-slogan) + 0.1rem);
    line-height: 1.4;
}

.auth-form {
    padding: 1.3rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: var(--text-dark);
    font-size: calc(var(--font-btn) * 0.95);
    line-height: 1.3;
}

.form-group input {
    width: 100%;
    padding: 0.7rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: calc(var(--font-btn) * 1.1);
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-dark);
    line-height: 1.4;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(30, 95, 140, 0.1);
    background: rgba(255, 255, 255, 1);
}

.form-group small {
    display: block;
    margin-top: 0.3rem;
    font-size: calc(var(--font-btn) * 0.8);
    color: var(--text-muted);
    line-height: 1.3;
}

.auth-form .auth-btn {
    width: 100%;
    padding: 0.9rem;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-green), var(--accent-emerald));
    color: white;
    border: none;
    border-radius: 6px;
    font-size: calc(var(--font-btn) * 1.1);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    line-height: 1.3;
}

.auth-form .auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(30, 95, 140, 0.4);
}

.auth-switch {
    text-align: center;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(229, 231, 235, 0.5);
}

.auth-switch p {
    font-size: calc(var(--font-btn) * 0.95);
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

.auth-switch button {
    background: none;
    border: none;
    color: var(--primary-blue);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    transition: all 0.3s ease;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: calc(var(--font-btn) * 0.95);
    line-height: 1.3;
}

.auth-switch button:hover {
    color: var(--secondary-green);
    background: rgba(30, 95, 140, 0.05);
    text-decoration: none;
}

/* Responsive pour modales sur petits écrans */
@media (max-width: 480px) {
    .auth-modal {
        padding: 0.5rem;
    }
    
    .auth-modal-content {
        max-width: 95vw;
        border-radius: 15px;
    }
    
    .auth-modal-header {
        padding: 1.5rem 1rem 0.6rem;
    }
    
    .auth-form {
        padding: 1rem;
    }
    
    .form-group {
        margin-bottom: 0.8rem;
    }
    
    .form-group input {
        padding: 0.6rem;
        font-size: calc(var(--font-btn) * 1.05);
    }
}

@media (max-width: 320px) {
    .auth-modal-content {
        max-width: 98vw;
        border-radius: 12px;
    }
    
    .auth-modal-header {
        padding: 1.2rem 0.8rem 0.5rem;
    }
    
    .auth-form {
        padding: 0.8rem;
    }
}

/* ===== NOTIFICATIONS RESPONSIVES ===== */
.notification-toast {
    position: fixed;
    top: calc(var(--header-height) + 15px);
    right: 15px;
    padding: 0.8rem 1.2rem;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    z-index: 10000;
    transform: translateX(100%);
    transition: all 0.4s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    max-width: min(90vw, 320px);
    font-size: calc(var(--font-btn) * 0.95);
    line-height: 1.4;
}

.notification-toast.show {
    transform: translateX(0);
}

.notification-toast.success {
    background: linear-gradient(135deg, var(--accent-emerald), #059669);
}

.notification-toast.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.notification-toast.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.notification-toast.info {
    background: linear-gradient(135deg, var(--primary-blue), #1d4ed8);
}

@media (max-width: 480px) {
    .notification-toast {
        top: calc(var(--header-height) + 10px);
        right: 10px;
        left: 10px;
        max-width: calc(100vw - 20px);
        padding: 0.7rem 1rem;
        font-size: calc(var(--font-btn) * 0.9);
        transform: translateY(-100%);
    }
    
    .notification-toast.show {
        transform: translateY(0);
    }
}

/* Animation d'auto-hide */
.notification-toast.show {
    animation: slideInAndHide 5s ease-in-out forwards;
}

@keyframes slideInAndHide {
    0% { 
        transform: translateX(100%); 
        opacity: 0; 
    }
    10%, 90% { 
        transform: translateX(0); 
        opacity: 1; 
    }
    100% { 
        transform: translateX(100%); 
        opacity: 0; 
    }
}

@media (max-width: 480px) {
    @keyframes slideInAndHide {
        0% { 
            transform: translateY(-100%); 
            opacity: 0; 
        }
        10%, 90% { 
            transform: translateY(0); 
            opacity: 1; 
        }
        100% { 
            transform: translateY(-100%); 
            opacity: 0; 
        }
    }
}

/* ===== GESTION DES ORIENTATIONS ===== */

/* Mode landscape sur mobile */
@media (max-width: 768px) and (orientation: landscape) {
    :root {
        --header-height: 50px;
        --logo-size: 28px;
        --font-title: 0.9rem;
        --font-slogan: 0.6rem;
        --font-btn: 0.6rem;
    }
    
    .nav-container {
        max-height: 80vh;
        padding: 1.2rem 1rem;
    }
    
    .main-nav a {
        padding: 0.6rem 1rem;
        margin: 0.2rem 0;
        font-size: 0.8rem;
    }
    
    .mobile-nav-header {
        margin-bottom: 1rem;
        padding-bottom: 0.8rem;
    }
    
    .mobile-nav-logo {
        width: 40px;
        height: 40px;
        margin-bottom: 0.5rem;
    }
    
    .mobile-nav-footer {
        margin-top: 1rem;
        padding-top: 0.8rem;
    }
}

/* ===== ACCESSIBILITÉ AVANCÉE ===== */

/* Modes d'accessibilité */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.1s !important;
    }
    
    .main-nav a {
        transition-delay: 0s !important;
    }
    
    .notification-toast.show {
        animation: none !important;
    }
}

@media (prefers-contrast: high) {
    .main-nav a,
    .auth-btn,
    .user-btn {
        border-width: 2px !important;
        font-weight: 600 !important;
    }
    
    .notification-toast {
        border: 2px solid rgba(255, 255, 255, 0.8) !important;
    }
    
    .form-group input:focus {
        border-width: 3px !important;
    }
}

/* Focus visible amélioré */
.main-nav a:focus-visible,
.auth-btn:focus-visible,
.user-btn:focus-visible,
.mobile-toggle:focus-visible {
    outline: 3px solid var(--gold-accent) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 6px rgba(240, 199, 94, 0.3) !important;
}

/* ===== OPTIMISATIONS POUR LA PERFORMANCE ===== */

/* Optimisation GPU */
.header-container,
.main-nav,
.auth-modal-content,
.nav-container {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Optimisation des transitions */
.main-nav a,
.auth-btn,
.user-btn {
    will-change: transform, opacity, box-shadow;
}

.main-nav a:hover,
.auth-btn:hover,
.user-btn:hover {
    will-change: auto;
}

/* ===== FALLBACKS POUR NAVIGATEURS ANCIENS ===== */

/* Fallback pour CSS Grid */
@supports not (display: grid) {
    .header-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .logo-section {
        flex: 0 0 auto;
    }
    
    .main-nav {
        flex: 1 1 auto;
    }
    
    .user-section {
        flex: 0 0 auto;
    }
}

/* Fallback pour variables CSS */
@supports not (color: var(--primary-blue)) {
    header {
        background: linear-gradient(135deg, #1e5f8c 0%, #2E8B57 50%, #10b981 100%);
    }
    
    .logo {
        width: 40px;
        height: 40px;
    }
    
    .site-title h1 {
        font-size: 1.2rem;
    }
    
    .main-nav a {
        font-size: 0.7rem;
        padding: 0.5rem 0.9rem;
    }
}

/* Fallback pour backdrop-filter */
@supports not (backdrop-filter: blur(10px)) {
    header {
        background: rgba(30, 95, 140, 0.98);
    }
    
    .nav-container {
        background: rgba(255, 255, 255, 0.98);
    }
    
    .auth-modal {
        background: rgba(15, 23, 42, 0.9);
    }
    
    .auth-modal-content {
        background: rgba(255, 255, 255, 0.99);
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    header {
        position: static !important;
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        padding: 1rem 0 !important;
        border-bottom: 2px solid #333 !important;
        height: auto !important;
    }
    
    .header-container {
        display: flex !important;
        justify-content: space-between !important;
        padding: 0 1rem !important;
    }
    
    .mobile-toggle,
    .auth-btn,
    .user-btn,
    .main-nav,
    .user-section {
        display: none !important;
    }
    
    .logo-section {
        color: black !important;
    }
    
    .site-title h1 {
        color: black !important;
        text-shadow: none !important;
        font-size: 1.5rem !important;
    }
    
    .site-title .slogan {
        color: #666 !important;
        text-shadow: none !important;
        font-size: 1rem !important;
    }
    
    .logo {
        width: 50px !important;
        height: 50px !important;
        border: 2px solid #333 !important;
    }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --text-dark: #f8fafc;
        --text-muted: #cbd5e1;
        --border-light: #374151;
    }
    
    .nav-container {
        background: rgba(15, 23, 42, 0.98);
        border-color: rgba(55, 65, 81, 0.8);
    }
    
    .main-nav a {
        color: var(--text-dark) !important;
        background: rgba(55, 65, 81, 0.3) !important;
        border-color: rgba(55, 65, 81, 0.5) !important;
    }
    
    .auth-modal-content {
        background: rgba(15, 23, 42, 0.98);
        border-color: rgba(55, 65, 81, 0.8);
    }
    
    .form-group input {
        background: rgba(55, 65, 81, 0.3);
        border-color: rgba(55, 65, 81, 0.8);
        color: var(--text-dark);
    }
    
    .user-dropdown {
        background: rgba(15, 23, 42, 0.98);
        border-color: rgba(55, 65, 81, 0.8);
    }
    
    .user-dropdown a,
    .user-dropdown button {
        color: var(--text-dark);
    }
}   
    .main-nav a::before {
        content: '' !important;
        position: absolute !important;
        top: 0 !important;
        left: -100% !important;
        width: 100% !important;
        height: 100% !important;
        background: linear-gradient(90deg, 
            transparent, 
            rgba(255, 255, 255, 0.15), 
            transparent) !important;
        transition: left 0.3s ease !important;
    }
    
    .main-nav a:hover::before {
        left: 100% !important;
    }
    
    .main-nav a:hover {
        background: linear-gradient(135deg, 
            rgba(240, 199, 94, 0.85), 
            rgba(16, 185, 129, 0.85)) !important;
        border-color: rgba(240, 199, 94, 0.6) !important;
        transform: translateY(-1px) scale(1.02) !important;
        box-shadow: 0 3px 8px rgba(240, 199, 94, 0.3) !important;
        color: white !important;
    }
    
    .main-nav a.active {
        background: linear-gradient(135deg, 
            rgba(240, 199, 94, 0.9), 
            rgba(16, 185, 129, 0.9)) !important;
        border-color: rgba(240, 199, 94, 0.8) !important;
        box-shadow: 0 0 8px rgba(240, 199, 94, 0.4) !important;
        color: white !important;
        font-weight: 600 !important;
    }
}

/* Navigation responsive pour écrans moyens */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-nav {
        gap: calc(var(--nav-gap) * 0.6);
    }
    
    .main-nav a {
        padding: calc(var(--nav-padding) * 0.8) !important;
        font-size: calc(var(--font-nav) * 0.9) !important;
        border-radius: 14px !important;
    }
}

/* ===== NAVIGATION MOBILE ===== */
.mobile-toggle {
    grid-area: toggle;
    display: none;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    font-size: calc(var(--font-btn) * 1.4);
    cursor: pointer;
    padding: calc(var(--btn-padding) * 0.8);
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.mobile-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
    transform: scale(1.05);
}

.mobile-toggle i {
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.mobile-toggle:hover i {
    transform: rotate(90deg);
}

@media (max-width: 768px) {
    .mobile-toggle {
        display: block;
    }
    
    /* Navigation mobile overlay responsive */
    .main-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh; /* Viewport dynamique pour mobile */
        background: rgba(15, 23, 42, 0.8);
        backdrop-filter: blur(12px);
        display: none;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        z-index: 9999;
        opacity: 0;
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        overflow-y: auto;
        overflow-x: hidden;
        padding: 1rem;
    }
    
    .main-nav.show {
        display: flex;
        opacity: 1;
    }
    
    .nav-container {
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(25px) saturate(180%);
        border-radius: 20px;
        padding: 1.8rem 1.2rem;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
        border: 1px solid rgba(226, 232, 240, 0.8);
        width: 100%;
        max-width: min(90vw, 380px);
        max-height: min(85vh, 85dvh);
        overflow-y: auto;
        transform: scale(0.8) translateY(50px);
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        position: relative;
    }
    
    .main-nav.show .nav-container {
        transform: scale(1) translateY(0);
    }
    
    .mobile-nav-header {
        text-align: center;
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
        border-bottom: 1px solid rgba(30, 95, 140, 0.1);
    }
    
    .mobile-nav-logo {
        width: calc(var(--logo-size) + 15px);
        height: calc(var(--logo-size) + 15px);
        border-radius: 50%;
        margin: 0 auto 0.8rem;
        border: 3px solid var(--primary-blue);
        padding: 4px;
        background: white;
        box-shadow: 0 6px 20px rgba(30, 95, 140, 0.3);
        object-fit: cover;
    }
    
    .mobile-nav-title {
        font-family: 'Playfair Display', serif;
        font-size: calc(var(--font-title) + 0.1rem);
        font-weight: 600;
        color: var(--primary-blue);
        margin: 0 0 0.3rem 0;
        line-height: 1.3;
    }
    
    .mobile-nav-subtitle {
        font-family: 'Cormorant Garamond', serif;
        font-size: calc(var(--font-slogan) + 0.1rem);
        color: var(--text-muted);
        font-style: italic;
        margin: 0;
        line-height: 1.3;
    }
    
    .main-nav a {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 0.8rem 1.2rem;
        margin: 0.3rem 0;
        background: rgba(30, 95, 140, 0.05);
        border: 1px solid transparent;
        border-radius: 10px;
        color: var(--primary-blue);
        text-decoration: none;
        font-weight: 600;
        font-size: calc(var(--font-nav) + 0.2rem);
        text-transform: uppercase;
        letter-spacing: 0.4px;
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        position: relative;
        overflow: hidden;
        opacity: 0;
        transform: translateX(-30px);
        line-height: 1.3;
    }
    
    .main-nav.show a {
        opacity: 1;
        transform: translateX(0);
    }
    
    /* Animation séquentielle des liens */
    .main-nav.show a:nth-child(1) { transition-delay: 0.05s; }
    .main-nav.show a:nth-child(2) { transition-delay: 0.08s; }
    .main-nav.show a:nth-child(3) { transition-delay: 0.11s; }
    .main-nav.show a:nth-child(4) { transition-delay: 0.14s; }
    .main-nav.show a:nth-child(5) { transition-delay: 0.17s; }
    .main-nav.show a:nth-child(6) { transition-delay: 0.2s; }
    .main-nav.show a:nth-child(7) { transition-delay: 0.23s; }
    .main-nav.show a:nth-child(8) { transition-delay: 0.26s; }
    .main-nav.show a:nth-child(9) { transition-delay: 0.29s; }
    
    .main-nav a:hover,
    .main-nav a.active {
        background: linear-gradient(135deg, rgba(30, 95, 140, 0.15), rgba(46, 139, 87, 0.15));
        border-color: rgba(30, 95, 140, 0.3);
        transform: translateX(6px) scale(1.01);
        box-shadow: 0 4px 15px rgba(30, 95, 140, 0.15);
        color: var(--secondary-green);
    }
    
    .main-nav a.active {
        background: linear-gradient(135deg, rgba(30, 95, 140, 0.2), rgba(46, 139, 87, 0.2));
        border-color: rgba(30, 95, 140, 0.4);
        font-weight: 700;
    }
    
    .main-nav a.active::after {
        content: '';
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        width: 6px;
        height: 6px;
        background: var(--accent-emerald);
        border-radius: 50%;
        box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
    }
    
    .mobile-nav-close {
        position: absolute;
        top: 0.8rem;
        right: 0.8rem;
        width: 32px;
        height: 32px;
        background: rgba(239, 68, 68, 0.1);
        border: 2px solid rgba(239, 68, 68, 0.2);
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #ef4444;
        font-size: 1rem;
        transition: all 0.3s ease;
        backdrop-filter: blur(10px);
        z-index: 10;
    }
    
    .mobile-nav-close:hover {
        background: rgba(239, 68, 68, 0.2);
        border-color: rgba(239, 68, 68, 0.4);
        transform: scale(1.1) rotate(90deg);
    }
    
    .mobile-nav-footer {
        text-align: center;
        margin-top: 1.5rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(30, 95, 140, 0.1);
    }
    
    .mobile-nav-footer p {
        font-size: calc(var(--font-slogan) + 0.05rem);
        color: var(--text-muted);
        margin: 0 0 0.8rem 0;
        line-height: 1.4;
    }
    
    .mobile-nav-actions {
        display: flex;
        gap: 0.6rem;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .mobile-action-btn {
        flex: 1;
        min-width: 90px;
        max-width: 110px;
        padding: calc(var(--btn-padding) * 0.9);
        background: linear-gradient(135deg, var(--primary-blue), var(--secondary-green));
        color: white;
        border: none;
        border-radius: 18px;
        font-weight: 600;
        font-size: calc(var(--font-btn) * 0.9);
        cursor: pointer;
        transition: all 0.3s ease;
        text-decoration: none;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        text-transform: uppercase;
        letter-spacing: 0.2px;
        line-height: 1.2;
    }
    
    .mobile-action-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 15px rgba(30, 95, 140, 0.4);
    }
    
    .mobile-action-btn.secondary {
        background: linear-gradient(135deg, var(--accent-emerald), #059669);
    }
}

/* Responsive mobile ultra-compact */
@media (max-width: 380px) {
    .nav-container {
        padding: 1.5rem 1rem;
        max-width: 95vw;
    }
    
    .main-nav a {
        padding: 0.7rem 1rem;
        font-size: calc(var(--font-nav) + 0.1rem);
        margin: 0.25rem 0;
    }
    
    .mobile-nav-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .mobile-action-btn {
        max-width: 100%;
        min-width: 100%;
    }
}

/* ===== SECTION UTILISATEUR RESPONSIVE ===== */
.user-section {
    grid-area: user;
    display: flex;
    align-items: center;
    gap: calc(var(--section-gap) * 0.6);
    position: relative;
    flex-shrink: 0;
    justify-self: end;
}

.auth-btn {
    background: rgba(255, 255, 255, 0.12) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    padding: var(--btn-padding) !important;
    border-radius: 16px !important;
    cursor: pointer !important;
    font-weight: 500 !important;
    font-size: var(--font-btn) !important;
    transition: all 0.25s ease !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
    backdrop-filter: blur(8px) !important;
    position: relative !important;
    overflow: hidden !important;
    text-transform: uppercase !important;
    letter-spacing: 0.2px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
}


/* Styles pour le dropdown utilisateur */
.user-section {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.user-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.user-btn i:last-child {
    transition: transform 0.3s ease;
}

.user-btn.active i:last-child {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
    display: none; /* Caché par défaut */
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 8px;
}

.user-dropdown.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.user-dropdown a,
.user-dropdown button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    border: none;
    background: none;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: left;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
    background-color: #f3f4f6;
}

.user-dropdown a:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.user-dropdown a:last-child,
.user-dropdown form:last-child button {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.user-dropdown button[style*="color: #ef4444"] {
    color: #ef4444 !important;
    border-top: 1px solid #e5e7eb;
    margin-top: 4px;
}

.user-dropdown button[style*="color: #ef4444"]:hover {
    background-color: #fef2f2;
}

.user-dropdown i {
    width: 16px;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .user-dropdown {
        right: 0;
        left: auto;
        min-width: 180px;
    }
}