/**
 * Navbar Fixe - Ardentys Theme
 * Version: 1.0.0
 */

/* ============================================
   NAVBAR FIXE
   ============================================ */

.navbar-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: transform 0.3s ease;
}

/* Ajustement pour la barre admin WordPress */
.admin-bar .navbar-fixed {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .navbar-fixed {
        top: 46px;
    }
}

.navbar-fixed__container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem var(--spacing-4);
    max-width: var(--container-max-width);
    margin: 0 auto;
}

@media (min-width: 769px) {
    .navbar-fixed__container {
        padding: 1rem var(--spacing-6);
    }
}

/* ============================================
   HAMBURGER MENU
   ============================================ */

.navbar-fixed__hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: transform 0.3s ease;
}

.navbar-fixed__hamburger:hover {
    transform: scale(1.1);
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background: #000000;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.navbar-fixed__hamburger:hover .hamburger-line {
    background: #000000;
}

/* Animation hamburger quand menu ouvert */
.sidebar-menu.is-open ~ .navbar-fixed .navbar-fixed__hamburger .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.sidebar-menu.is-open ~ .navbar-fixed .navbar-fixed__hamburger .hamburger-line:nth-child(2) {
    opacity: 0;
}

.sidebar-menu.is-open ~ .navbar-fixed .navbar-fixed__hamburger .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ============================================
   ICÔNES SOCIALES
   ============================================ */

.navbar-fixed__socials {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

/* Menu WordPress - supprimer les styles de liste */
.navbar-fixed__socials ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.navbar-fixed__socials li {
    margin: 0;
    padding: 0;
    display: inline-block;
}

.navbar-fixed__socials a {
    color: #000000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.navbar-fixed__socials a:hover {
    color: #000000;
    background: rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.navbar-fixed__socials svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   SIDEBAR MENU
   ============================================ */

.sidebar-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    pointer-events: none;
}

.sidebar-menu.is-open {
    pointer-events: auto;
}

/* Overlay sombre */
.sidebar-menu__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-menu.is-open .sidebar-menu__overlay {
    opacity: 1;
}

/* Contenu de la sidebar */
.sidebar-menu__content {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 85vw;
    height: 100%;
    background: var(--color-primary);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.sidebar-menu.is-open .sidebar-menu__content {
    transform: translateX(0);
}

/* Ajustement sidebar pour la barre admin WordPress */
.admin-bar .sidebar-menu__content {
    top: 32px;
    height: calc(100% - 32px);
}

@media screen and (max-width: 782px) {
    .admin-bar .sidebar-menu__content {
        top: 46px;
        height: calc(100% - 46px);
    }
}

/* Zone de contenu scrollable */
.sidebar-menu__scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2rem 1.5rem;

    /* Masquer la scrollbar tout en gardant le scroll fonctionnel */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE et Edge */
}

/* Masquer la scrollbar pour Chrome, Safari et Opera */
.sidebar-menu__scrollable::-webkit-scrollbar {
    display: none;
}

/* Bouton fermer en bas avec flèche - toujours visible */
.sidebar-menu__close-bottom {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.sidebar-menu__close-bottom:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-menu__close-bottom svg {
    transition: transform 0.3s ease;
}

.sidebar-menu__close-bottom:hover svg {
    transform: translateX(5px);
}

/* Sections du menu */
.sidebar-menu__section {
    margin-bottom: 2.5rem;
}

.sidebar-menu__section:first-of-type {
    margin-top: 0;
}

.sidebar-menu__title {
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    opacity: 0.8;
}

/* Liste des menus */
.sidebar-menu__list,
.mobile-nav__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu__list .mobile-nav__item,
.mobile-nav__list .mobile-nav__item {
    margin-bottom: 0.5rem;
}

.sidebar-menu__list .mobile-nav__link,
.mobile-nav__list .mobile-nav__link {
    display: block;
    color: #ffffff;
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.sidebar-menu__list .mobile-nav__link:hover,
.mobile-nav__list .mobile-nav__link:hover {
    color: #ffffff;
    background: rgba(0, 0, 0, 0.15);
    padding-left: 1.5rem;
    transform: translateX(5px);
    border-left: 4px solid #c8ae7e;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.sidebar-menu__list .mobile-nav__link--active,
.mobile-nav__list .mobile-nav__link--active {
    background: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

.sidebar-menu__list .mobile-nav__link--active::before,
.mobile-nav__list .mobile-nav__link--active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: #ffffff;
    border-radius: 0 4px 4px 0;
}

/* ============================================
   SOUS-MENUS
   ============================================ */

/* Élément parent avec sous-menu */
.mobile-nav__item.menu-item-has-children > .mobile-nav__link {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-nav__item.menu-item-has-children > .mobile-nav__link::after {
    content: '›';
    font-size: 1.5rem;
    font-weight: 400;
    transition: transform 0.3s ease;
    display: inline-block;
}

.mobile-nav__item.menu-item-has-children.is-open > .mobile-nav__link::after {
    transform: rotate(90deg);
}

/* Liste des sous-menus */
.mobile-nav__submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-nav__item.menu-item-has-children.is-open > .mobile-nav__submenu {
    max-height: 1000px;
    margin-top: 0.25rem;
}

/* Items de sous-menu */
.mobile-nav__submenu .mobile-nav__item {
    margin-bottom: 0.25rem;
}

.mobile-nav__submenu .mobile-nav__link {
    font-size: 0.9rem;
    padding: 0.6rem 1rem 0.6rem 2rem;
    font-weight: 400;
    opacity: 0.9;
}

.mobile-nav__submenu .mobile-nav__link:hover {
    opacity: 1;
    padding-left: 2.5rem;
}

.mobile-nav__submenu .mobile-nav__link::before {
    content: '–';
    position: absolute;
    left: 1rem;
    opacity: 0.6;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablettes */
@media (max-width: 768px) {
    .navbar-fixed__socials {
        gap: 1rem;
    }

    .navbar-fixed__socials ul {
        gap: 1rem;
    }

    .navbar-fixed__socials a {
        width: 32px;
        height: 32px;
    }

    .navbar-fixed__socials svg {
        width: 18px;
        height: 18px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .navbar-fixed__socials {
        gap: 0.75rem;
    }

    .navbar-fixed__socials ul {
        gap: 0.75rem;
    }

    .navbar-fixed__socials a {
        width: 28px;
        height: 28px;
    }

    .navbar-fixed__socials svg {
        width: 16px;
        height: 16px;
    }

    .hamburger-line {
        width: 22px;
    }

    .sidebar-menu__content {
        width: 280px;
        padding: 1.5rem 1rem;
    }
}

/* ============================================
   UTILITAIRES
   ============================================ */

/* Empêcher le scroll quand la sidebar est ouverte */
/* Note: Les styles sont appliqués via JavaScript inline pour un meilleur contrôle */
body.sidebar-open {
    /* overflow et position sont gérés par JS */
}

html.sidebar-open {
    overflow: hidden !important;
}

/* Skip link accessible */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-primary);
    color: #ffffff;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Ajouter du padding-top au main pour compenser la navbar fixe */
.site-main {
    padding-top: 70px;
}

@media screen and (max-width: 782px) {
    .admin-bar .site-main {
        padding-top: 116px; /* 70px navbar + 46px admin bar */
    }
}

/* Page d'accueil sans padding-top (hero full screen) */
.home .site-main {
    padding-top: 0;
}

/* ============================================
   LOGO DANS LA NAVBAR
   ============================================ */

.navbar-fixed__logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.navbar-fixed__logo.show {
    opacity: 1;
    pointer-events: auto;
}

/* Sur les pages non-home, toujours afficher le logo */
body:not(.home) .navbar-fixed__logo {
    opacity: 1;
    pointer-events: auto;
}

.navbar-logo-img {
    height: 50px;
    width: auto;
    display: block;
}

.navbar-logo-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1a1a1a;
    text-decoration: none;
}

@media (max-width: 768px) {
    .navbar-logo-img {
        height: 40px;
    }

    .navbar-logo-text {
        font-size: 1.2rem;
    }
}
