/* ==========================================================================
   KAROMA — NAVBAR
   ========================================================================== */


/* ==========================================================================
   1. NAVBAR DESKTOP
   ========================================================================== */

.navbar {
    position: fixed;

    top: 0;
    left: 50%;

    transform: translateX(-50%);

    width: 95%;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0.6rem 1.2rem;

    background: var(--violet);

    border-bottom: 3px solid #ddd;
    border-radius: 0 0 12px 12px;

    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);

    z-index: 1000;

    font-size: 1rem;
}


/* ==========================================================================
   2. LOGO
   ========================================================================== */

.navbar-brand {
    display: flex;
    align-items: center;

    gap: 14px;

    padding: 0;

    background: transparent;
    border: none;

    color: white;
    text-decoration: none;

    cursor: pointer;
}

.logo-img {
    display: block;

    width: auto;
    height: 55px;

    object-fit: contain;
}

.navbar-brand span {
    color: white;

    font-size: 1.2rem;
    font-weight: 600;
}


/* ==========================================================================
   3. MENU PRINCIPAL
   ========================================================================== */

.nav-links {
    display: flex;
    align-items: center;

    gap: 8px;
}

.nav-links > button,
.nav-links > .dropdown > .dropdown-btn {

    appearance: none;
    -webkit-appearance: none;

    padding: 0.45rem 0.8rem;

    background: transparent;
    border: none;
    border-radius: 6px;

    color: white;

    font-family: inherit;
    font-size: inherit;
    font-weight: 500;

    text-decoration: none;
    white-space: nowrap;

    cursor: pointer;

    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}


/* ==========================================================================
   4. ÉTAT ACTIF / HOVER
   ========================================================================== */

.nav-links > button:hover,
.nav-links > button.active,

.nav-links > .dropdown > .dropdown-btn:hover,
.nav-links > .dropdown > .dropdown-btn.active {

    background: var(--violet-clair);
    color: var(--gold);
}


/* ==========================================================================
   5. DROPDOWN
   ========================================================================== */

.dropdown {
    position: relative;
}


/* --------------------------------------------------------------------------
   Contenu
   -------------------------------------------------------------------------- */

.dropdown-content {

    display: none;

    position: absolute;

    top: 100%;
    left: 0;

    min-width: 280px;

    padding: 0;

    background: var(--violet);

    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 10px 10px;

    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);

    overflow: hidden;

    z-index: 1100;
}


/* --------------------------------------------------------------------------
   Boutons
   -------------------------------------------------------------------------- */

.dropdown-content button {

    display: block;

    width: 100%;

    padding: 0.75rem 1.2rem;

    background: transparent;
    border: none;

    color: white;

    font-family: inherit;
    font-size: inherit;

    text-align: left;

    cursor: pointer;

    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}

.dropdown-content button:hover {

    background: rgba(255, 255, 255, 0.2);
    color: var(--gold);
}


/* --------------------------------------------------------------------------
   Ouverture desktop
   -------------------------------------------------------------------------- */

@media (min-width: 769px) {

    .dropdown:hover .dropdown-content,
    .dropdown:focus-within .dropdown-content {
        display: block;
    }

    .mobile-menu-btn {
        display: none !important;
    }
}


/* ==========================================================================
   6. TABLETTE
   1200px et moins
   ========================================================================== */

@media (max-width: 1200px) {

    .navbar {
        width: 94%;

        padding: 0.7rem 1rem;

        gap: 0.75rem;
    }

    .nav-links {
        gap: 0.4rem;
    }

    .nav-links > button,
    .nav-links > .dropdown > .dropdown-btn {
        padding: 0.45rem 0.7rem;

        font-size: 0.85rem;
    }
}


/* ==========================================================================
   7. PETITE TABLETTE
   900px et moins
   ========================================================================== */

@media (max-width: 900px) {

    .navbar {
        width: 96%;
    }

    .nav-links {
        gap: 0.25rem;
    }

    .nav-links > button,
    .nav-links > .dropdown > .dropdown-btn {
        padding: 0.4rem 0.55rem;

        font-size: 0.8rem;
    }
}


/* ==========================================================================
   8. MOBILE
   768px et moins
   ========================================================================== */

@media (max-width: 768px) {

    .navbar {

        position: relative;

        left: auto;
        top: auto;

        transform: none;

        width: 100%;
        min-height: 70px;

        padding: 0.5rem 0.75rem;

        display: flex;
        flex-direction: column;
        align-items: stretch;

        gap: 0;
    }


    /* ----------------------------------------------------------------------
       LOGO
       ---------------------------------------------------------------------- */

    .navbar-brand {

        width: 100%;

        display: flex;
        align-items: center;
        justify-content: center;

        padding: 0.3rem;
    }

    .navbar-brand .logo-img {
        width: auto;
        max-width: 55px;
        height: auto;
    }


    /* ----------------------------------------------------------------------
       HAMBURGER
       ---------------------------------------------------------------------- */

    .mobile-menu-btn {

        display: flex !important;

        position: absolute;

        top: 0.75rem;
        right: 0.75rem;

        width: 42px;
        height: 42px;

        align-items: center;
        justify-content: center;

        padding: 0;

        border: none;
        border-radius: 7px;

        background: var(--violet);
        color: white;

        font-size: 1.4rem;
        line-height: 1;

        cursor: pointer;

        z-index: 1001;
    }


    /* ----------------------------------------------------------------------
       MENU
       ---------------------------------------------------------------------- */

    .nav-links {

        display: none !important;

        width: 100%;

        flex-direction: column;
        align-items: stretch;

        gap: 0.2rem;

        padding: 0.5rem 0 0.75rem;

        max-height: calc(100dvh - 90px);

        overflow-y: auto;
        overflow-x: hidden;
    }


    .navbar.mobile-menu-open .nav-links {
        display: flex !important;
    }


    /* ----------------------------------------------------------------------
       BOUTONS PRINCIPAUX
       ---------------------------------------------------------------------- */

    .nav-links > button,
    .nav-links > .dropdown > .dropdown-btn {

        position: relative;

        width: 100%;
        min-height: 42px;

        padding: 0.6rem 2.5rem 0.6rem 0.8rem;

        border-radius: 7px;

        background: transparent;
        color: var(--color-text);

        text-align: left;

        font-family: inherit;
        font-size: 0.9rem;
        line-height: 1.3;

        white-space: normal;
    }

    .nav-links > button:active,
    .nav-links > .dropdown > .dropdown-btn:active {

        background: var(--violet-clair);
        color: white;
    }


    /* ----------------------------------------------------------------------
       DROPDOWN MOBILE
       ---------------------------------------------------------------------- */

    .dropdown {
        width: 100%;
    }

    .dropdown-btn::after {

        content: "›";

        position: absolute;

        top: 50%;
        right: 1rem;

        transform: translateY(-50%) rotate(90deg);

        font-size: 1.2rem;

        transition: transform 0.2s ease;
    }

    .dropdown.mobile-open .dropdown-btn::after {
        transform: translateY(-50%) rotate(-90deg);
    }


    /* ----------------------------------------------------------------------
       SOUS-MENU MOBILE
       ---------------------------------------------------------------------- */

    .dropdown-content {

        position: static !important;

        display: none;

        width: 100%;
        min-width: 0;

        margin: 0;

        padding: 0.2rem 0 0.4rem 0.75rem;

        background: transparent;

        border: none !important;
        border-radius: 0;

        box-shadow: none !important;
    }


    /*
       Important :
       le hover desktop ne doit pas ouvrir le sous-menu sur mobile.
    */

    .dropdown:hover .dropdown-content {
        display: none;
    }

    .dropdown.mobile-open .dropdown-content {
        display: block;
    }


    /* ----------------------------------------------------------------------
       BOUTONS SOUS-MENU
       ---------------------------------------------------------------------- */

    .dropdown-content button {

        display: block;

        width: 100%;

        padding: 0.55rem 0.75rem;

        border: none;
        border-radius: 5px;

        background: transparent;
        color: var(--color-text);

        text-align: left;

        font-family: inherit;
        font-size: 0.82rem;
        line-height: 1.4;

        white-space: normal;
    }

    .dropdown-content button:active {

        background: var(--violet-clair);
        color: white;
    }
}


/* ==========================================================================
   9. PETIT MOBILE
   480px et moins
   ========================================================================== */

@media (max-width: 480px) {

    .navbar {
        padding: 0.4rem 0.5rem;
    }

    .navbar-brand .logo-img {
        max-width: 48px;
    }

    .mobile-menu-btn {

        top: 0.6rem;
        right: 0.6rem;

        width: 40px;
        height: 40px;

        font-size: 1.3rem;
    }

    .nav-links {
        gap: 0.2rem;
        max-height: calc(100dvh - 85px);
    }

    .nav-links > button,
    .nav-links > .dropdown > .dropdown-btn {

        min-height: 40px;

        padding: 0.55rem 2.3rem 0.55rem 0.7rem;

        font-size: 0.85rem;
    }

    .dropdown-content button {

        padding: 0.5rem 0.65rem;

        font-size: 0.78rem;
    }
}


/* ==========================================================================
   10. TRÈS PETIT MOBILE
   360px et moins
   ========================================================================== */

@media (max-width: 360px) {

    .navbar-brand .logo-img {
        max-width: 44px;
    }

    .mobile-menu-btn {

        width: 38px;
        height: 38px;
    }

    .nav-links > button,
    .nav-links > .dropdown > .dropdown-btn {
        font-size: 0.8rem;
    }

    .dropdown-content button {
        font-size: 0.75rem;
    }
}

