@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --nav-font: 'Plus Jakarta Sans', sans-serif;
    
    /* Couleurs fixes */
    --primary-blue: #2563EB;
    --primary-dark: #1E40AF;
    --accent-lime: #a6ff00;
    
    /* Variables dynamiques (changent au scroll) */
    --nav-text-color: #FFFFFF; /* Blanc par défaut (sur fond sombre) */
    --nav-bg-color: transparent;
    --nav-backdrop: none;
    --nav-shadow: none;
    --nav-height: 90px;
    --logo-filter: brightness(0) invert(1); /* Logo blanc */
}

/* --- ETAT SCROLLE (Classe JS ajoutée) --- */
.navbar-wrapper.scrolled {
    --nav-text-color: #1F2937; /* Gris sombre */
    --nav-bg-color: rgba(255, 255, 255, 0.85); /* Blanc vitré */
    --nav-backdrop: blur(12px);
    --nav-shadow: 0 4px 20px rgba(0,0,0,0.05);
    --nav-height: 70px; /* Plus compact */
    --logo-filter: none; /* Logo original (couleur) */
}

/* Cas Spécial: Page "Light" (ex: fond blanc dès le départ) 
   Ajouter <body class="nav-light"> sur les pages concernées 
*/
body.nav-light .navbar-wrapper:not(.scrolled) {
    --nav-text-color: #1F2937;
    --nav-bg-color: rgba(255, 255, 255, 0.72);
    --nav-backdrop: blur(14px);
    --nav-shadow: 0 16px 40px -26px rgba(15, 23, 42, 0.32);
    --logo-filter: none;
}
/* Mais quand on scroll sur nav-light, ça devient blanc vitré comme les autres */


body.nav-light .navbar-wrapper:not(.scrolled) .nav-links-desktop {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(15, 23, 42, 0.08);
}

body.nav-light .navbar-wrapper:not(.scrolled) .nav-link:hover {
    background: rgba(15, 23, 42, 0.08);
}

body.nav-light .navbar-wrapper:not(.scrolled) .nav-link.active {
    background: #1F2937;
    color: #FFFFFF;
    box-shadow: 0 10px 24px -18px rgba(15, 23, 42, 0.7);
}

body.nav-light .navbar-wrapper:not(.scrolled) .phone-icon-circle {
    background: rgba(15, 23, 42, 0.05);
    border-color: rgba(15, 23, 42, 0.12);
}

body.nav-light .navbar-wrapper:not(.scrolled) .btn-account {
    border-color: rgba(15, 23, 42, 0.14);
    color: #1F2937;
}

/* Bouton compte CONNECTÉ (cercle vert plein) : garder l'icône blanche aussi sur
   les pages nav-light (sinon la règle ci-dessus la passe en sombre sur fond vert). */
body.nav-light .navbar-wrapper:not(.scrolled) .btn-account.logged-in {
    color: #fff;
    border-color: transparent;
}

body.nav-light .navbar-wrapper:not(.scrolled) .btn-account:hover {
    background: rgba(15, 23, 42, 0.05);
    border-color: rgba(15, 23, 42, 0.28);
}

/* --- MAIN STYLES --- */
body {
    margin: 0; /* Important */
}

.navbar-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: var(--nav-bg-color);
    backdrop-filter: var(--nav-backdrop);
    -webkit-backdrop-filter: var(--nav-backdrop);
    box-shadow: var(--nav-shadow);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    font-family: var(--nav-font);
    /* Entry animation (slide down + fade), inspiré de 21st.dev */
    animation: navbarSlideDown 0.8s ease-out both;
}

/* Slide-down du header au chargement de la page */
@keyframes navbarSlideDown {
    from {
        opacity: 0;
        transform: translateY(-100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Respect du prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .navbar-wrapper {
        animation: none !important;
    }
}

.navbar-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 1. Logo */
.brand-logo {
    display: flex;
    align-items: center;
    z-index: 1001; /* Au dessus */
}

.logo-img {
    height: 42px;
    transition: height 0.4s ease, filter 0.4s ease;
    filter: var(--logo-filter);
}

.navbar-wrapper.scrolled .logo-img {
    height: 36px; /* Logo réduit au scroll */
}

/* 2. Desktop Navigation */
.nav-links-desktop {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05); /* Légère capsule pour grouper */
    padding: 6px;
    border-radius: 99px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.3s, border 0.3s;
}

/* Au scroll, la capsule du menu change aussi */
.navbar-wrapper.scrolled .nav-links-desktop {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.05);
}

.nav-link {
    text-decoration: none;
    color: var(--nav-text-color);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 18px;
    border-radius: 99px;
    transition: all 0.3s ease;
    opacity: 0.9;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
}

.navbar-wrapper.scrolled .nav-link:hover {
    background: rgba(0, 0, 0, 0.08); /* Hover sombre sur fond clair */
}

.nav-link.active {
    background: #FFFFFF;
    color: #000000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-weight: 600;
    opacity: 1;
}

.navbar-wrapper.scrolled .nav-link.active {
    background: #1F2937;
    color: #FFFFFF;
}

/* 3. Actions & Buttons */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* --- PHONE ACTION --- */
.action-phone {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--nav-text-color);
    margin-right: 12px;
    transition: opacity 0.3s;
}

.action-phone:hover {
    opacity: 0.8;
}

/* Cercle icône téléphone */
.phone-icon-circle {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.navbar-wrapper.scrolled .phone-icon-circle {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

.action-phone .material-symbols-rounded {
    font-size: 18px;
}

/* Groupe texte téléphone */
.phone-text-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.2;
}

.phone-label {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 500;
    opacity: 0.8;
    letter-spacing: 0.5px;
}

.phone-number {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

/* --- BUTTON DEVIS --- */
.btn-devis {
    height: 44px; /* Hauteur fixe pour alignement */
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-blue);
    color: white;
    padding: 0 24px;
    border-radius: 99px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    box-sizing: border-box;
}

.btn-devis:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-devis .arrow {
    font-size: 18px;
    transition: transform 0.3s;
}

.btn-devis:hover .arrow {
    transform: translateX(4px);
}

/* --- ACCOUNT BUTTON --- */
.btn-account {
    width: 44px;  /* Même dimension que la hauteur du btn devis */
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.3);
    color: var(--nav-text-color);
    text-decoration: none;
    transition: all 0.3s;
    box-sizing: border-box;
}

.btn-account span {
    font-size: 24px;
}

.btn-account:hover {
    background: rgba(255,255,255,0.15);
    border-color: #fff;
    transform: translateY(-1px);
}

/* Style au scroll (fond blanc) */
.navbar-wrapper.scrolled .btn-account {
    border-color: rgba(0,0,0,0.15);
    color: #1F2937;
}
.navbar-wrapper.scrolled .btn-account:hover {
    background: rgba(0,0,0,0.05);
    border-color: #000;
}

/* Style connecté */
.btn-account.logged-in {
    background: #10B981;
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}
.btn-account.logged-in:hover {
    background: #059669;
    transform: translateY(-1px);
}

.navbar-wrapper.scrolled .btn-account.logged-in {
    color: white;
}

/* --- BURGER BUTTON --- */
.hamburger-btn {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    padding: 0;
    z-index: 1002;
}

.bar {
    width: 100%;
    height: 2px;
    background-color: var(--nav-text-color);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-btn.active .top {
    transform: rotate(45deg) translate(5px, 5px);
    background-color: #1F2937;
}
.hamburger-btn.active .mid { opacity: 0; }
.hamburger-btn.active .bot {
    transform: rotate(-45deg) translate(8px, -8px);
    background-color: #1F2937;
}

/* --- MOBILE MENU OVERLAY --- */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mobile-menu-content {
    width: 100%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    text-align: center;
}

.mobile-header {
    position: absolute;
    top: 25px;
    left: 25px;
    right: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-title {
    font-size: 20px;
    font-weight: 700;
    color: #1F2937;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    display: none;
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.mobile-nav-links a {
    font-size: 24px;
    font-weight: 600;
    color: #1F2937;
    text-decoration: none;
    transition: color 0.2s;
}

.mobile-nav-links a:hover {
    color: var(--primary-blue);
}

.mobile-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    margin-top: 20px;
}

.mobile-btn-devis {
    background: var(--primary-blue);
    color: white;
    padding: 14px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    width: 100%;
    display: block;
}

.mobile-btn-account {
    border: 1px solid #E5E7EB;
    color: #1F2937;
    padding: 14px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mobile-phone-link {
    color: #6B7280;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    font-weight: 500;
}

/* --- RESPONSIVE BREAKPOINTS --- */
@media (max-width: 1100px) {
    .nav-links-desktop { display: none; }
    .hamburger-btn { display: flex; }
    
    .action-phone { display: none; }
    .btn-devis { display: none; }
    .btn-account { display: none; }
}

@media (max-width: 480px) {
    .navbar-container {
        padding: 0 20px;
    }
    .logo-img {
        height: 32px;
    }
}
