/* ==========================================================================
   Header Styles
   ========================================================================== */

/* --- Site Header --- */
.site-header {
    background-color: var(--footer-bg);
    color: var(--header-text);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 100;
}

.site-header a {
    color: var(--header-text);
    text-decoration: none;
    font-weight: 600;
}

.site-header a:hover {
    color: var(--header-accent);
}

/* --- Top Bar --- */
.header-top {
    height: 80px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background-color: var(--white);
}

.header-top-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 20px;
}

/* --- Branding --- */
.site-branding {
    color: var(--white);
}

.site-branding .site-logo-image img {
    display: block;
    max-width: 100%;
    height: auto;
}

.site-title {
    font-size: 1.5rem;
    margin: 0;
    font-family: var(--font-heading);
    color: var(--white);
    font-weight: 700;
}

/* --- Header Actions --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 30px;
}


/* --- Text Links (Carte, Chasse aux trésors) --- */
.header-text-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.header-text-links .text-link {
    font-size: 1rem;
    font-weight: 600;
    color: var(--footer-bg-dark);
    text-decoration: none;
    padding-bottom: 2px;
    border-bottom: 2px solid var(--white);
    transition: var(--transition);
}

.header-text-links .text-link:hover {
    color: var(--header-accent);
    border-bottom-color: var(--header-accent);
}

/* --- Header Icons (User & Cart) --- */
.header-icons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.icon-link {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    position: relative;
    color: var(--footer-text-hover);
    background: none;
    transition: var(--transition);
}

/* Force les icônes SVG à être blanches */
.icon-link svg,
.icon-user,
.icon-cart {
    color: var(--footer-bg-dark);
    background: none;
}

.icon-user:hover,
.icon-link:hover {
    color: #d5701e;
}

.social-icon,
.social-icon svg {
    transition: var(--transition);
}

.social-icon svg, .social-icon .social-img {
    width: 35px;
    height: 35px;
}

@media (max-width: 768px) {
    .social-icon svg, .social-icon .social-img {
        width: 30px;
        height: 30px;
    }
}

.social-icon:hover {
    transform: translateY(-3px);
    opacity: 0.8;
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -8px;
    background: var(--header-accent);
    color: var(--white);
    font-size: 0.7rem;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Bottom Bar (Main Navigation) --- */
.header-bottom {
    padding: 15px 0;
    background-color: var(--white);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.header-bottom-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0 20px;
}

/* --- Main Navigation --- */
.main-navigation {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    gap: 50px;
    margin: 0;
    padding: 0;
}

.main-navigation a {
    text-transform: none;
    font-size: 1.8rem;
    letter-spacing: normal;
    color: var(--header-text);
    font-weight: 700;
    font-family: var(--font-heading);
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.main-navigation a:hover,
.main-navigation .current-menu-item>a {
    border-bottom-color: var(--header-text);
    color: var(--header-text);
}

/* --- Search Toggle --- */
.header-search {
    position: relative;
    margin-left: 1rem;
}

.search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--header-text);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
    z-index: 1001;
}

.search-toggle:hover {
    color: var(--header-accent);
    transform: scale(1.1);
}

.search-toggle svg {
    transition: transform 0.3s ease;
}

.search-toggle[aria-expanded="true"] svg {
    transform: rotate(90deg);
}

/* --- Search Form --- */
.header-search-form {
    position: absolute;
    top: calc(100% + 1rem);
    right: 0;
    background: var(--white);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 1.5rem;
    min-width: 320px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
}

.header-search-form.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.header-search-form form {
    display: flex;
    gap: 0.5rem;
}

.header-search-form input[type="search"] {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

.header-search-form input[type="search"]:focus {
    outline: none;
    border-color: var(--header-accent);
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.1);
}

.header-search-form button[type="submit"] {
    padding: 0.75rem 1.5rem;
    background: var(--footer-bg);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    font-family: var(--font-body);
}

.header-search-form button[type="submit"]:hover {
    background: #d5701e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
}

/* Bouton fermer pour mobile */
.header-search-form .search-close {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--white);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: var(--transition);
    z-index: 10;
}

.header-search-form .search-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* --- Hero Section --- */
.hero-section {
    position: relative;
    width: 100%;
    height: 600px;
    background-color: #333;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(40px, 10vw, 150px);
    color: var(--white);
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Mega Menu Styles
   ========================================================================== */

.mega-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mega-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mega-menu-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background-color: rgb(247, 247, 247);
    padding: 60px 80px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    max-width: 90%;
    width: auto;
    min-width: 500px;
}

.mega-menu-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.mega-menu-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--header-accent);
    font-size: 1rem;
    font-weight: 600;
    transition: opacity 0.2s ease;
}

.mega-menu-close:hover {
    opacity: 0.7;
}

.mega-menu-close svg {
    width: 24px;
    height: 24px;
}

.mega-menu-content {
    text-align: center;
}

.mega-menu-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--header-text);
    margin: 0 0 30px 0;
    font-weight: 400;
    opacity: 0.7;
}

.mega-menu-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.mega-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 15px 35px;
    background-color: var(--footer-bg);
    color: var(--white) !important;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-body);
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.mega-menu-btn:hover {
    background-color: var(--footer-bg-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    color: var(--white) !important;
}

.mega-menu-btn svg {
    flex-shrink: 0;
}

/* ==========================================================================
/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablettes */
@media (max-width: 991px) {
    .header-top {
        height: auto;
        min-height: 80px;
        padding: 15px 0;
    }

    .header-top-inner {
        flex-direction: column;
        gap: 15px;
        padding: 10px 15px;
    }

    .site-branding {
        text-align: center;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 20px;
    }

    .main-navigation ul {
        gap: 30px;
    }

    .main-navigation a {
        font-size: 1rem;
    }
}

/* Smartphones */
@media (max-width: 768px) {
    .header-top-inner {
        padding: 10px;
    }

    .site-title {
        font-size: 1.3rem;
    }

    .header-bottom {
        padding: 10px 0;
    }

    .header-bottom-inner {
        flex-direction: column;
        gap: 15px;
        padding: 0 10px;
    }

    .header-search {
        position: static;
        margin-left: 0;
        order: 1;
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }

    .header-search-form {
        right: 10px;
        left: 10px;
        min-width: auto;
        width: calc(100% - 20px);
        padding: 1.25rem;
    }

    .header-search-form input[type="search"] {
        font-size: 0.95rem;
        padding: 0.65rem 0.9rem;
    }

    .header-search-form button[type="submit"] {
        padding: 0.65rem 1.25rem;
        font-size: 0.95rem;
    }

    .main-navigation {
        width: 100%;
        order: 2;
    }

    .main-navigation ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
        padding: 10px 0;
    }

    .main-navigation a {
        font-size: 0.95rem;
        padding: 8px 12px;
    }

    .header-actions {
        gap: 15px;
    }

    .header-text-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .header-text-links .text-link {
        font-size: 0.9rem;
    }

    .hero-section {
        height: 300px;
    }

    .hero-title {
        font-size: 3rem;
        padding: 0 20px;
    }

    /* Mega Menu Mobile */
    .mega-menu-panel {
        padding: 40px 30px;
        min-width: auto;
        width: 90%;
        max-width: 500px;
        max-height: 80vh;
        overflow-y: auto;
    }

    .mega-menu-title {
        font-size: 1.1rem;
        margin-bottom: 20px;
    }

    .mega-menu-buttons {
        flex-direction: column;
        gap: 15px;
    }

    .mega-menu-btn {
        width: 100%;
        font-size: 1rem;
        padding: 12px 25px;
    }

    .mega-menu-close {
        top: 15px;
        right: 15px;
        font-size: 0.9rem;
    }
}

/* Très petits écrans */
@media (max-width: 480px) {
    .header-top-inner {
        padding: 10px 5px;
    }

    .site-title {
        font-size: 1.1rem;
    }

    .header-actions {
        gap: 10px;
    }

    .header-text-links {
        width: 100%;
    }

    .header-text-links .text-link {
        font-size: 0.85rem;
        flex: 1;
        text-align: center;
    }

    .header-icons {
        gap: 12px;
    }

    .icon-link svg {
        width: 20px;
        height: 20px;
    }

    .header-search {
        position: static;
    }

    /* Bouton fermer visible sur mobile */
    .header-search-form .search-close {
        display: flex;
    }

    .header-search-form {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        min-width: auto;
        border-radius: 0;
        padding: 3rem 1.5rem 2rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transform: translateY(-100%);
        width: 100%;
        opacity: 0;
        visibility: hidden;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
        z-index: 10000;
    }

    .header-search-form.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .header-search-form form {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        max-width: 400px;
    }

    .header-search-form input[type="search"],
    .header-search-form button[type="submit"] {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
    }

    .main-navigation ul {
        gap: 10px;
    }

    .main-navigation a {
        font-size: 0.9rem;
        padding: 6px 10px;
    }

    .hero-section {
        height: 250px;
    }

    .hero-title {
        font-size: 2rem;
        padding: 0 15px;
    }

    /* Mega Menu très petit écran */
    .mega-menu-panel {
        padding: 30px 20px;
        width: 95%;
    }

    .mega-menu-title {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    .mega-menu-btn {
        font-size: 0.95rem;
        padding: 10px 20px;
    }

    .mega-menu-close {
        top: 10px;
        right: 10px;
        font-size: 0.85rem;
    }

    .mega-menu-close svg {
        width: 20px;
        height: 20px;
    }
}

/* Très très petits écrans (320px) */
@media (max-width: 360px) {
    .site-title {
        font-size: 1rem;
    }

    .header-text-links .text-link {
        font-size: 0.8rem;
        padding-bottom: 1px;
        border-bottom-width: 1px;
    }

    .main-navigation a {
        font-size: 0.85rem;
        padding: 5px 8px;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .mega-menu-btn {
        font-size: 0.9rem;
        padding: 10px 15px;
    }
}