/* ==========================================================================
   Retraide — User Sub-Navbar (Desktop) & Mobile Drawer (Connected UX)
   ========================================================================== */

/* --- 1. DESKTOP USER SUB-NAVBAR --- */
.retraide-user-subbar {
    display: none; /* Mobile first: hidden on mobile */
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    width: 100%;
    position: relative;
    z-index: 99;
}

@media only screen and (min-width: 75em) { /* >= 1200px (Desktop) */
    .retraide-user-subbar {
        display: block;
    }
}

.retraide-user-subbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 30px;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    gap: 1rem;
}

.retraide-user-subbar__left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.retraide-user-subbar__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #e2e8f0;
    color: #334155;
    font-size: 0.8125rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 9999px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.retraide-user-subbar__badge.is-pro {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #ffffff;
}

.retraide-user-subbar__list {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.retraide-subnav-item {
    margin: 0;
    padding: 0;
}

.retraide-subnav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    background-color: transparent;
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
    border: 1px solid transparent;
}

.retraide-subnav-link:hover,
.retraide-subnav-link:focus {
    background-color: #ffffff;
    color: #009bfe;
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    text-decoration: none;
}

.retraide-subnav-link i {
    font-size: 0.85rem;
    color: #64748b;
    transition: color 0.2s ease;
}

.retraide-subnav-link:hover i {
    color: #009bfe;
}

.retraide-subnav-count {
    color: #64748b;
    font-weight: 500;
    font-size: 0.8rem;
}

/* Pastille rouge de notification */
.retraide-subnav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9999px;
    background-color: #ef4444;
    color: #ffffff;
    font-size: 0.725rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.4);
    animation: retraide-pulse 2s infinite;
}

@keyframes retraide-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}

/* Bouton Déposer une annonce dans la sous-barre */
.retraide-user-subbar__right {
    display: flex;
    align-items: center;
}

.retraide-subnav-btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 18px;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 700;
    color: #ffffff !important;
    background: linear-gradient(135deg, #10b981, #059669);
    text-decoration: none !important;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
    transition: all 0.2s ease;
    white-space: nowrap;
    border: none;
}

.retraide-subnav-btn-submit:hover,
.retraide-subnav-btn-submit:focus {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
    color: #ffffff !important;
}

.retraide-subnav-btn-submit i {
    font-size: 0.85rem;
}

/* Top bar user greeting & logout styles */
.header-navbar .header-navbar__menu ul li.retraide-menu-item--user-profile {
    display: flex;
    align-items: center;
    padding: 0 8px;
}

.header-navbar .header-navbar__menu ul li.retraide-menu-item--user-profile a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.925rem;
    font-weight: 600;
    color: #1e293b !important;
    text-decoration: none;
}

.retraide-menu-avatar-wrap,
.retraide-mobile-avatar-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.retraide-menu-user-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #009bfe;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: inline-block;
    flex-shrink: 0;
}

.retraide-menu-user-avatar-letter {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background-color: #009bfe;
    color: #ffffff !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    user-select: none;
    flex-shrink: 0;
}

.retraide-mobile-user-avatar-letter {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background-color: #009bfe;
    color: #ffffff !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    user-select: none;
    flex-shrink: 0;
}

.retraide-btn--logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b !important;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.retraide-btn--logout:hover {
    background-color: #fee2e2;
    color: #dc2626 !important;
    border-color: #fca5a5;
}


/* --- 2. MOBILE DRAWER & BURGER ENHANCEMENTS --- */
.header-navbar__burger-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #334155;
    text-decoration: none;
    font-size: 1.5rem;
}

.retraide-burger-unread-dot {
    position: absolute;
    top: -3px;
    right: -5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ef4444;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    animation: retraide-pulse 2s infinite;
}

/* Mobile Drawer Overlay Container */
.header-navbar__drawer {
    display: none; /* Controlled by navigation.js */
    position: fixed !important;
    z-index: 999999 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background-color: #ffffff !important;
    padding: 1rem 1.25rem 2.5rem !important;
    box-sizing: border-box !important;
    -webkit-overflow-scrolling: touch;
}

/* Header inside mobile drawer (Logo + Bouton Fermer) */
.header-navbar__drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.header-navbar__drawer-logo {
    display: flex;
    align-items: center;
    position: relative;
    z-index: 10;
}

.header-navbar__drawer-logo a,
.header-navbar__drawer-logo .custom-logo-link {
    display: inline-flex !important;
    align-items: center !important;
    text-decoration: none !important;
    cursor: pointer !important;
}

.header-navbar__drawer-logo img,
.header-navbar__drawer-logo .custom-logo {
    max-height: 48px;
    width: auto;
    max-width: 160px;
    display: block;
    object-fit: contain;
    cursor: pointer !important;
}

.header-navbar__drawer-logo .header-logo__name {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    cursor: pointer !important;
}

/* Bouton Fermer minimaliste & épuré */
.header-navbar__drawer-close {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: transparent;
    color: #64748b;
    font-size: 1.35rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
}

.header-navbar__drawer-close:hover,
.header-navbar__drawer-close:focus {
    background-color: #fee2e2;
    color: #dc2626;
    transform: rotate(90deg);
}

/* Mobile User Card */
.retraide-mobile-user-card {
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 12px;
    margin-bottom: 14px;
    margin-top: 4px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.retraide-mobile-user-card__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.retraide-mobile-user-card__avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #009bfe;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.retraide-mobile-user-card__greeting {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.retraide-mobile-user-card__role {
    font-size: 0.775rem;
    font-weight: 600;
    color: #0284c7;
    margin-top: 2px;
}

.retraide-mobile-user-card__links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.retraide-mobile-user-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    background-color: #ffffff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.retraide-mobile-user-link:hover,
.retraide-mobile-user-link:focus {
    background-color: #f0f9ff;
    border-color: #bae6fd;
    color: #0284c7;
    text-decoration: none;
}

.retraide-mobile-user-link-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.retraide-mobile-user-link-left i {
    width: 18px;
    text-align: center;
    color: #64748b;
}

.retraide-mobile-user-link:hover .retraide-mobile-user-link-left i {
    color: #0284c7;
}

.retraide-mobile-user-link.is-logout {
    color: #dc2626;
    background-color: #fef2f2;
    border-color: #fecaca;
    margin-top: 2px;
}

.retraide-mobile-user-link.is-logout i {
    color: #dc2626;
}

/* Mobile Nav Divider */
.retraide-mobile-nav-divider {
    display: flex;
    align-items: center;
    margin: 16px 0 10px;
    color: #94a3b8;
    font-size: 0.725rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.retraide-mobile-nav-divider::before,
.retraide-mobile-nav-divider::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid #f1f5f9;
}

.retraide-mobile-nav-divider span {
    padding: 0 8px;
}

/* Masquer les éléments redondants dans la liste wp_nav_menu du tiroir */
.header-navbar__drawer-nav .retraide-menu-item--user-profile,
.header-navbar__drawer-nav .retraide-menu-item--user-logout,
.header-navbar__drawer-nav .retraide-menu-item--listing-submit,
.header-navbar__drawer-nav .retraide-menu-item--user-login {
    display: none !important;
}

/* Mobile Drawer Nav List — Style épuré, aéré (sans barre à gauche ni fond gris) */
.header-navbar__drawer .header-navbar__drawer-nav ul::before {
    display: none !important;
    content: none !important;
}

.header-navbar__drawer-nav ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

.header-navbar__drawer-nav > ul > li {
    margin: 0 !important;
    padding: 0 0 8px 0 !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

.header-navbar__drawer-nav > ul > li:last-child {
    border-bottom: none !important;
}

.header-navbar__drawer-nav > ul > li > a {
    display: flex !important;
    align-items: center !important;
    padding: 10px 0 4px !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    text-decoration: none !important;
    border: none !important;
}

.header-navbar__drawer-nav > ul > li > a:hover {
    color: #009bfe !important;
}

/* Sub-menus : arborescence épurée sans trait vertical */
.header-navbar__drawer-nav ul li ul.sub-menu {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 2px 0 6px 12px !important;
    margin: 0 !important;
    gap: 0 !important;
    list-style: none !important;
}

.header-navbar__drawer-nav ul li ul.sub-menu li {
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.header-navbar__drawer-nav ul li ul.sub-menu li a {
    font-size: 0.925rem !important;
    font-weight: 500 !important;
    color: #64748b !important;
    padding: 6px 0 !important;
    display: block !important;
    border: none !important;
    text-decoration: none !important;
    transition: color 0.15s ease !important;
}

.header-navbar__drawer-nav ul li ul.sub-menu li a:hover {
    color: #009bfe !important;
}

.header-navbar__drawer-bottom {
    margin-top: 18px;
    padding-top: 6px;
}

.retraide-btn--block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 18px;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 10px;
    text-align: center;
    box-sizing: border-box;
}

.retraide-btn--mb-sm {
    margin-bottom: 8px;
}

/* --- 3. RESPONSIVE MOBILE HEADER ADJUSTMENTS --- */
@media only screen and (max-width: 74.99em) {
    .site-header {
        position: relative;
        width: 100%;
        background-color: #ffffff;
        box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
    }

    .header-navbar {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 10px 16px !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        gap: 10px !important;
        margin: 0 !important;
    }

    .header-navbar__start {
        margin: 0 !important;
        padding: 0 !important;
        flex: 0 1 auto !important;
        min-width: 0 !important;
        display: flex !important;
        align-items: center !important;
        position: relative !important;
        z-index: 20 !important;
    }

    .header-logo {
        display: flex !important;
        align-items: center !important;
        position: relative !important;
        z-index: 20 !important;
    }

    .header-logo a,
    .header-logo .custom-logo-link {
        display: inline-flex !important;
        align-items: center !important;
        cursor: pointer !important;
        pointer-events: auto !important;
        position: relative !important;
        z-index: 20 !important;
        text-decoration: none !important;
    }

    .header-logo img,
    .header-logo .custom-logo {
        max-height: 40px !important;
        height: 40px !important;
        width: auto !important;
        max-width: 140px !important;
        object-fit: contain !important;
        display: block !important;
        cursor: pointer !important;
        pointer-events: auto !important;
    }

    .header-navbar__end {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 10px !important;
        margin: 0 !important;
        padding: 0 !important;
        flex: 0 0 auto !important;
    }

    .header-navbar__logged-out-mobile {
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
    }

    .header-navbar__logged-out-mobile .mobile-login-link {
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        font-size: 0.85rem !important;
        padding: 7px 14px !important;
        line-height: 1.2 !important;
        border-radius: 9999px !important;
        font-weight: 600 !important;
        background: linear-gradient(135deg, #009bfe, #0084d6) !important;
        color: #ffffff !important;
        box-shadow: 0 2px 8px rgba(0, 155, 254, 0.25) !important;
        white-space: nowrap !important;
        text-decoration: none !important;
        transition: all 0.2s ease !important;
    }

    .header-navbar__logged-out-mobile .mobile-login-link:hover,
    .header-navbar__logged-out-mobile .mobile-login-link:focus {
        background: linear-gradient(135deg, #0084d6, #006bb3) !important;
        box-shadow: 0 3px 10px rgba(0, 155, 254, 0.35) !important;
        transform: translateY(-1px);
    }

    .header-navbar__logged-out-mobile .mobile-login-link i {
        font-size: 0.85rem !important;
        margin: 0 !important;
    }

    .header-navbar__burger {
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .header-navbar__burger > a,
    .header-navbar__burger-trigger {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 38px !important;
        height: 38px !important;
        font-size: 1.4rem !important;
        color: #1e293b !important;
        text-decoration: none !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 8px !important;
        cursor: pointer;
        transition: background-color 0.15s ease !important;
    }

    .header-navbar__burger-trigger:hover {
        background-color: #f1f5f9 !important;
    }

    .header-navbar__menu {
        display: none !important;
    }
}

/* Écrans ultra compacts (< 360px) */
@media only screen and (max-width: 22.5em) {
    .header-logo img,
    .header-logo .custom-logo {
        max-height: 32px !important;
        max-width: 110px !important;
    }

    .header-navbar__logged-out-mobile .mobile-login-link span {
        display: none !important;
    }

    .header-navbar__logged-out-mobile .mobile-login-link {
        padding: 8px !important;
        border-radius: 50% !important;
    }
}
