/* public/css/header.css - Styles spécifiques à l'en-tête optimisés */

/* ===== EN-TÊTE PRINCIPAL ===== */
.main-header {
    position: sticky;
    top: 0;
    z-index: var(--z-fixed);
    background: var(--white);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

/* ===== BARRE SUPÉRIEURE ===== */
.top-bar {
    background: var(--primary-green);
    color: var(--white);
    font-size: var(--font-size-sm);
    transition: all 0.3s ease;
}

.top-bar.collapsed {
    padding: 0.25rem 0;
}

.top-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.contact-info {
    display: flex;
    gap: 1rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.contact-item i {
    opacity: 0.8;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Liens d'authentification */
.auth-links {
    display: flex;
    gap: 0.75rem;
}

.auth-link {
    color: var(--white);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-base);
    font-size: var(--font-size-sm);
    height: 32px; /* Hauteur fixe pour cohérence */
    min-width: fit-content;
}

.auth-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.auth-link.register-link {
    background: var(--accent-green);
}

.auth-link.register-link:hover {
    background: var(--secondary-green);
}

/* Menu utilisateur */
.user-menu .user-toggle {
    background: none;
    border: none;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-base);
    cursor: pointer;
    font-family: inherit;
    height: 32px; /* Même hauteur que les auth-links */
}

.user-menu .user-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

/* Sélecteur de langue */
.language-toggle {
    background: none;
    border: none;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-base);
    cursor: pointer;
    font-family: inherit;
    height: 32px; /* Même hauteur que les autres éléments */
}

.language-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ===== NAVIGATION PRINCIPALE ===== */
.main-navigation {
    background: var(--white);
    padding: 0;
    border-bottom: 1px solid var(--gray-200);
}

.nav-content {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 0;
}

/* Logo de marque */
.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--primary-green);
    min-width: fit-content;
}

.logo-image {
    width: 35px;
    height: 35px;
    object-fit: contain;
}

.logo-text .brand-name {
    font-size: 1.25rem;
    font-weight: var(--font-weight-bold);
    margin: 0;
    line-height: 1;
}

.logo-text .brand-tagline {
    font-size: 0.75rem;
    color: var(--gray-600);
}

/* Conteneur de recherche */
.search-container {
    flex-grow: 1;
    max-width: 420px;
    border: 2px solid var(--primary-green);
    border-radius: var(--border-radius);
    margin: 0 auto;
}

.search-form {
    display: flex;
    width: 100%;
}

.search-input-group {
    display: flex;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    height: 38px;
}

.search-input {
    flex: 1;
    border: 1px solid var(--gray-200);
    border-right: none;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    outline: none;
    border-radius: 0;
}

.search-input:focus {
    border-color: var(--primary-green);
    box-shadow: none;
}

.category-filter {
    max-width: 120px;
    border: 1px solid var(--gray-200);
    border-right: none;
    border-left: none;
    border: 1px solid var(--primary-green);
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    background: var(--white);
    outline: none;
}

.category-filter:focus {
    border-color: var(--primary-green);
    box-shadow: none;
}

.search-button {
    padding: 0.5rem 0.75rem;
    border-radius: 0;
    font-weight: var(--font-weight-semibold);
    font-size: 0.875rem;
    min-width: 45px;
}

/* Menu de navigation */
.nav-menu .nav-list {
    display: flex;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
    text-decoration: none;
    color: var(--gray-700);
    padding: 0.75rem 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition-base);
    font-size: 0.75rem;
    font-weight: var(--font-weight-medium);
    height: 60px; /* Hauteur fixe pour tous les liens */
    justify-content: center;
}

.nav-link:hover {
    color: var(--primary-green);
    background: var(--gray-100);
}

.nav-link i {
    font-size: 0.875rem;
}

.nav-link span {
    font-size: 0.625rem;
}

/* Menu déroulant des catégories */
.nav-item.dropdown .mega-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 700px;
    max-width: 90vw;
    background: var(--white);
    border: none;
    box-shadow: var(--shadow-xl);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-top: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    z-index: var(--z-dropdown);
}

/* Hover pour desktop */
.nav-item.dropdown:hover .mega-menu {
    opacity: 1;
    visibility: visible;
}

/* Toggle pour mobile/tablette - utilise Bootstrap */
.nav-item.dropdown .mega-menu.show {
    opacity: 1;
    visibility: visible;
}

/* Ajustements responsive pour le mega-menu */
@media (max-width: 1024px) {
    .nav-item.dropdown .mega-menu {
        width: 100%;
        max-width: 320px;
        left: 0;
        transform: none;
        padding: 1rem;
    }
    
    /* Sur tablette/mobile, désactiver le hover et utiliser uniquement le clic */
    .nav-item.dropdown:hover .mega-menu {
        opacity: 0;
        visibility: hidden;
    }
    
    /* Forcer l'utilisation du toggle Bootstrap */
    .nav-item.dropdown .mega-menu.show {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 768px) {
    .nav-item.dropdown .mega-menu {
        max-width: 300px;
        padding: 0.75rem;
    }
    
    .mega-menu-content .col-md-3 {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .category-title {
        font-size: var(--font-size-sm);
        margin-bottom: 0.5rem;
    }
    
    .mega-menu-content li a {
        font-size: var(--font-size-sm);
        padding: 0.25rem 0.5rem;
    }
}

/* Actions de navigation */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: fit-content;
}

.action-btn {
    position: relative;
    width: 38px; /* Taille standardisée */
    height: 38px; /* Même hauteur que la barre de recherche */
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition-base);
    font-size: 0.875rem;
}

.action-btn:hover {
    background: var(--primary-green);
    color: var(--white);
}

/* Compteurs de notifications */
.cart-count,
.notification-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: var(--white);
    font-size: 9px;
    font-weight: var(--font-weight-bold);
    border-radius: 50%;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1px;
    line-height: 1;
}

/* Bouton vendre - Tailles standardisées */
.sell-btn {
    height: 38px; /* Même hauteur que les action-btn */
    padding: 0 1rem;
    font-size: 0.875rem;
    font-weight: var(--font-weight-semibold);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: fit-content;
}

/* Bouton menu mobile */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    width: 38px; /* Même taille que les action-btn */
    height: 38px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    padding: 0;
}

.hamburger-line {
    width: 20px;
    height: 2px;
    background: var(--gray-700);
    border-radius: 1px;
    transition: var(--transition-base);
}

.mobile-menu-toggle:hover .hamburger-line {
    background: var(--primary-green);
}

/* Animation du menu hamburger */
.mobile-menu-toggle.active .hamburger-line:first-child {
    transform: rotate(45deg) translate(4px, 4px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:last-child {
    transform: rotate(-45deg) translate(5px, -4px);
}

/* Bouton scroll-to-top */
.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--primary-green);
    color: var(--white);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--transition-base);
    z-index: 999;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    background: var(--secondary-green);
    transform: translateY(-2px);
}

/* Barre de recherche mobile intégrée */
.mobile-search-bar {
    background: var(--primary-green);
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 0.75rem;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.mobile-search-bar.active {
    opacity: 1;
    max-height: 100px;
}

.mobile-search-bar .search-input-group {
    height: 40px;
}

/* ===== ACTIONS MOBILES DANS TOPBAR ===== */
.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.top-bar-actions .action-btn {
    width: 28px; /* Taille adaptée pour la top-bar */
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.75rem;
}

.top-bar-actions .action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: var(--white);
}

.top-bar-actions .cart-count,
.top-bar-actions .notification-count {
    top: -2px;
    right: -2px;
    min-width: 12px;
    height: 12px;
    font-size: 8px;
}

/* Bouton Vendre dans la top-bar mobile */
.top-bar-actions .btn-primary {
    height: 28px; /* Même hauteur que les action-btn de la top-bar */
    padding: 0 0.75rem;
    font-size: 0.75rem;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    /* Ajustements généraux */
    .top-bar .contact-info {
        gap: 0.5rem;
        font-size: 0.75rem;
        flex: 1;
        min-width: 0;
    }
    
    .contact-item {
        gap: 0.25rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }
    
    .contact-item i {
        font-size: 0.75rem;
        flex-shrink: 0;
    }
    
    .top-bar .top-bar-content {
        padding: 0.375rem 0;
    }
    
    .header-actions {
        gap: 0.5rem;
        flex-shrink: 0;
    }
    
    .auth-link {
        padding: 0.25rem;
        font-size: 0.75rem;
        height: 28px; /* Ajusté pour mobile */
    }
    
    .user-avatar {
        width: 24px;
        height: 24px;
    }
    
    .user-menu .user-toggle {
        padding: 0.25rem;
        font-size: 0.75rem;
        height: 28px;
    }
    
    .language-toggle {
        padding: 0.25rem;
        font-size: 0.75rem;
        height: 28px;
    }
    
    /* Navigation principale */
    .nav-content {
        grid-template-columns: auto 1fr auto;
        gap: 0.5rem;
        padding: 0.5rem 0;
    }
    
    .logo-image {
        width: 30px;
        height: 30px;
    }
    
    .brand-logo .logo-text .brand-name {
        font-size: 1rem;
    }
    
    /* Barre de recherche mobile */
    .search-container {
        display: block;
        max-width: 280px;
        border-width: 1px;
        margin: 0 0.5rem;
    }
    
    .search-input-group {
        height: 34px;
    }
    
    .search-input {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .category-filter {
        max-width: 90px;
        padding: 0.4rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .search-button {
        padding: 0.4rem 0.6rem;
        min-width: 34px;
        font-size: 0.8rem;
    }
    
    /* Actions */
    .action-btn {
        width: 34px;
        height: 34px;
        font-size: 0.8rem;
    }
    
    .cart-count,
    .notification-count {
        min-width: 14px;
        height: 14px;
        font-size: 8px;
        top: -3px;
        right: -3px;
    }
    
    .sell-btn {
        height: 34px;
        padding: 0 0.8rem;
        font-size: 0.8rem;
    }
    
    .mobile-menu-toggle {
        width: 34px;
        height: 34px;
    }
    
    .hamburger-line {
        width: 18px;
        height: 2px;
    }
    
    /* Menu de navigation */
    .nav-link {
        padding: 0.6rem 0.5rem;
        font-size: 0.75rem;
        height: 50px;
    }
    
    .nav-link i {
        font-size: 0.9rem;
    }
    
    .nav-link span {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    /* Écrans très petits */
    .top-bar .contact-info {
        font-size: 0.7rem;
    }
    
    .contact-item {
        max-width: 100px;
        font-size: 0.7rem;
    }
    
    .header-actions {
        gap: 0.25rem;
    }
    
    .auth-link {
        padding: 0.2rem 0.3rem;
        font-size: 0.65rem;
        height: 26px;
    }
    
    .user-menu .user-toggle {
        padding: 0.2rem 0.3rem;
        font-size: 0.65rem;
        height: 26px;
        gap: 0.25rem;
    }
    
    .user-avatar {
        width: 20px;
        height: 20px;
    }
    
    .language-toggle {
        padding: 0.2rem 0.3rem;
        font-size: 0.65rem;
        height: 26px;
        gap: 0.2rem;
    }
    
    /* Navigation principale ultra-compacte */
    .nav-content {
        padding: 0.375rem 0;
        gap: 0.375rem;
    }
    
    .search-container {
        max-width: 220px;
        margin: 0 0.375rem;
    }
    
    .search-input-group {
        height: 30px;
    }
    
    .search-input {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .category-filter {
        max-width: 70px;
        padding: 0.3rem 0.5rem;
        font-size: 0.6rem;
    }
    
    .search-button {
        padding: 0.3rem 0.5rem;
        min-width: 30px;
        font-size: 0.7rem;
    }
    
    .logo-image {
        width: 24px;
        height: 24px;
    }
    
    .brand-logo .logo-text .brand-name {
        font-size: 0.9rem;
    }
    
    .action-btn {
        width: 30px;
        height: 30px;
        font-size: 0.7rem;
    }
    
    .cart-count,
    .notification-count {
        min-width: 12px;
        height: 12px;
        font-size: 7px;
        top: -2px;
        right: -2px;
    }
    
    .sell-btn {
        height: 30px;
        padding: 0 0.6rem;
        font-size: 0.7rem;
    }
    
    .mobile-menu-toggle {
        width: 30px;
        height: 30px;
    }
    
    .hamburger-line {
        width: 16px;
        height: 1.5px;
    }
    
    /* Menu navigation ultra-compact */
    .nav-link {
        padding: 0.4rem 0.3rem;
        font-size: 0.65rem;
        height: 44px;
    }
    
    .nav-link i {
        font-size: 0.8rem;
    }
    
    .nav-link span {
        font-size: 0.55rem;
    }
    
    /* Actions top-bar ultra-compactes */
    .top-bar-actions .action-btn {
        width: 24px;
        height: 24px;
        font-size: 0.65rem;
    }
    
    .top-bar-actions .btn-primary {
        height: 24px;
        padding: 0 0.5rem;
        font-size: 0.65rem;
        gap: 0.2rem;
    }
    
    .top-bar-actions .cart-count,
    .top-bar-actions .notification-count {
        min-width: 10px;
        height: 10px;
        font-size: 6px;
        top: -1px;
        right: -1px;
    }
}

@media (max-width: 369px) {
    /* Écrans ultra-petits - Ajustements spéciaux */
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .top-bar .top-bar-content {
        padding: 0.2rem 0;
        gap: 0.25rem;
    }
    
    .contact-info {
        gap: 0.2rem;
        font-size: 0.6rem;
    }
    
    .contact-item {
        max-width: 80px;
        font-size: 0.6rem;
    }
    
    .contact-item i {
        font-size: 0.6rem;
    }
    
    .header-actions {
        gap: 0.2rem;
    }
    
    .auth-link {
        padding: 0.15rem 0.25rem;
        font-size: 0.6rem;
        height: 22px;
    }
    
    .user-menu .user-toggle {
        padding: 0.15rem 0.25rem;
        font-size: 0.6rem;
        height: 22px;
        gap: 0.15rem;
    }
    
    .user-avatar {
        width: 18px;
        height: 18px;
    }
    
    .language-toggle {
        padding: 0.15rem 0.25rem;
        font-size: 0.6rem;
        height: 22px;
        gap: 0.15rem;
    }
    
    /* Navigation ultra-compacte */
    .nav-content {
        padding: 0.25rem 0;
        gap: 0.25rem;
    }
    
    .search-container {
        max-width: 180px;
        margin: 0 0.25rem;
    }
    
    .search-input-group {
        height: 26px;
    }
    
    .search-input {
        padding: 0.25rem 0.4rem;
        font-size: 0.6rem;
    }
    
    .category-filter {
        max-width: 60px;
        padding: 0.25rem 0.4rem;
        font-size: 0.5rem;
    }
    
    .search-button {
        padding: 0.25rem 0.4rem;
        min-width: 26px;
        font-size: 0.6rem;
    }
    
    .logo-image {
        width: 20px;
        height: 20px;
    }
    
    .brand-logo .logo-text .brand-name {
        font-size: 0.8rem;
    }
    
    .brand-logo .logo-text .brand-tagline {
        display: none; /* Masquer le tagline sur très petits écrans */
    }
    
    .action-btn {
        width: 26px;
        height: 26px;
        font-size: 0.65rem;
    }
    
    .sell-btn {
        height: 26px;
        padding: 0 0.5rem;
        font-size: 0.65rem;
    }
    
    .mobile-menu-toggle {
        width: 26px;
        height: 26px;
    }
    
    .hamburger-line {
        width: 14px;
        height: 1px;
    }
    
    .nav-link {
        padding: 0.35rem 0.25rem;
        font-size: 0.6rem;
        height: 40px;
    }
    
    .nav-link i {
        font-size: 0.7rem;
    }
    
    .nav-link span {
        font-size: 0.5rem;
    }
    
    /* Actions top-bar ultra-mini */
    .top-bar-actions .action-btn {
        width: 20px;
        height: 20px;
        font-size: 0.6rem;
    }
    
    .top-bar-actions .btn-primary {
        height: 20px;
        padding: 0 0.4rem;
        font-size: 0.6rem;
        gap: 0.15rem;
    }
    
    .top-bar-actions .cart-count,
    .top-bar-actions .notification-count {
        min-width: 8px;
        height: 8px;
        font-size: 5px;
        top: 0px;
        right: 0px;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    /* Tablettes - Garder le menu de navigation mais plus compact */
    .nav-menu .nav-list {
        gap: 0.2rem;
    }
    
    .nav-link {
        padding: 0.5rem 0.4rem;
        font-size: 0.7rem;
        height: 55px;
    }
    
    .nav-link i {
        font-size: 0.8rem;
    }
    
    .nav-link span {
        font-size: 0.55rem;
    }
    
    .search-container {
        max-width: 300px;
    }
    
    .action-btn {
        width: 36px;
        height: 36px;
    }
    
    .sell-btn {
        height: 36px;
        padding: 0 0.9rem;
        font-size: 0.85rem;
    }
}

/* ===== AMÉLIORATIONS POUR LA COHÉRENCE VISUELLE ===== */

/* Assurer que tous les éléments interactifs ont un feedback visuel cohérent */
.auth-link, .user-toggle, .language-toggle, .action-btn, .sell-btn, .nav-link {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus states pour l'accessibilité */
.auth-link:focus,
.user-toggle:focus,
.language-toggle:focus,
.action-btn:focus,
.sell-btn:focus,
.nav-link:focus {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}

/* États actifs pour les liens de navigation */
.nav-link.active {
    color: var(--primary-green);
    background: rgba(44, 85, 48, 0.1);
}

.nav-link.active i {
    color: var(--primary-green);
}

/* Améliorer la lisibilité des compteurs */
.cart-count[data-cart-count="0"],
.notification-count[data-notification-count="0"] {
    display: none !important;
}

/* Animation pour l'apparition des compteurs */
.cart-count,
.notification-count {
    animation: bounceIn 0.3s ease-out;
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Améliorer la lisibilité sur écrans tactiles */
@media (hover: none) {
    .action-btn:hover,
    .nav-link:hover,
    .auth-link:hover {
        transform: none;
    }
}