/**
 * Modern Header Styles - Centered Layout
 * Design épuré avec logo centré, navigation à gauche, actions à droite
 */

:root {
    --mh-text-color: #1a1a1a;
    --mh-text-light: #666666;
    --mh-secondary: #ffffff;
    --mh-accent: var(--primary, #007bff);
    --mh-accent-hover: color-mix(in srgb, var(--primary, #007bff) 80%, black 20%);
    --mh-border: #e8e8e8;
    --mh-bg-light: #f8f9fa;
    --mh-shadow: rgba(0, 0, 0, 0.06);
    --mh-shadow-md: rgba(0, 0, 0, 0.1);
    --mh-shadow-lg: rgba(0, 0, 0, 0.15);
    --mh-overlay: rgba(0, 0, 0, 0.5);
    --mh-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --mh-z-base: 1000;
    --mh-font-family: var(--shop-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);
}

/* Header Principal */
.modern-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    background: var(--mh-secondary);
    z-index: var(--mh-z-base);
    font-family: var(--mh-font-family);
    box-shadow: 0 1px 0 var(--mh-border);
}

.modern-header__container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 3rem;
    height: 100px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 3rem;
}

/* Navigation à gauche */
.modern-header__nav {
    justify-self: start;
    display: none;
}

.modern-header__menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.modern-header__menu-item {
    position: relative;
}

.modern-header__menu-link {
    display: block;
    padding: 1rem 1.75rem;
    color: var(--mh-text-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.35rem;
    letter-spacing: 0.01em;
    border-radius: 8px;
    transition: var(--mh-transition);
    position: relative;
}

.modern-header__menu-link::before {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--mh-accent);
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.modern-header__menu-link:hover {
    color: var(--mh-accent);
    background: color-mix(in srgb, var(--mh-accent) 5%, transparent);
}

.modern-header__menu-link:hover::before {
    width: 70%;
}

.modern-header__menu-link.active {
    color: var(--mh-accent);
}

.modern-header__menu-link.active::before {
    width: 70%;
}

/* Logo centré */
.modern-header__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.modern-header__logo:hover {
    transform: scale(1.05);
}

.modern-header__logo-img {
    height: 65px;
    width: auto;
    object-fit: contain;
}

/* Actions à droite */
.modern-header__actions {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.modern-header__action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border: none;
    background: transparent;
    color: var(--mh-text-color);
    cursor: pointer;
    border-radius: 50%;
    transition: var(--mh-transition);
    position: relative;
}

.modern-header__action-btn:hover {
    background: color-mix(in srgb, var(--mh-accent) 8%, transparent);
    color: var(--mh-accent);
    transform: scale(1.05);
}

.modern-header__action-btn:active {
    transform: scale(0.95);
}

.modern-header__icon {
    width: 26px;
    height: 26px;
}

/* Search Panel */
.modern-header__search-panel {
    position: absolute;
    top: calc(100% + 1rem);
    right: 0;
    width: 400px;
    max-width: 90vw;
    background: var(--mh-secondary);
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--mh-shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--mh-transition);
    z-index: calc(var(--mh-z-base) + 50);
}

.modern-header__search-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.modern-header__search-form {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    gap: 0.5rem;
}

.modern-header__search-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid var(--mh-border);
    border-radius: 10px;
    font-size: 0.95rem;
    transition: var(--mh-transition);
    outline: none;
    font-family: var(--mh-font-family);
}

.modern-header__search-input:focus {
    border-color: var(--mh-accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--mh-accent) 10%, transparent);
}

.modern-header__search-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: var(--mh-accent);
    color: var(--mh-secondary);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--mh-transition);
    flex-shrink: 0;
}

.modern-header__search-submit:hover {
    background: var(--mh-accent-hover);
    transform: scale(1.05);
}

/* Cart Badge */
.modern-header__cart-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #dc3545;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: cartBadgePulse 0.5s ease;
}

@keyframes cartBadgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Cart Panel */
.modern-header__cart-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 90vw;
    height: 100vh;
    background: var(--mh-secondary);
    box-shadow: -4px 0 24px var(--mh-shadow-lg);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: calc(var(--mh-z-base) + 100);
    display: flex;
    flex-direction: column;
}

.modern-header__cart-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--mh-text-color);
}

.modern-header__cart-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--mh-text-color);
    cursor: pointer;
    border-radius: 8px;
    transition: var(--mh-transition);
}

.modern-header__cart-close:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    transform: rotate(90deg);
}

.modern-header__cart-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modern-header__cart-products {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
}

.modern-header__cart-products::-webkit-scrollbar {
    width: 6px;
}

.modern-header__cart-products::-webkit-scrollbar-track {
    background: transparent;
}

.modern-header__cart-products::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.modern-header__cart-products::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

.modern-header__cart-footer {
    padding: 2rem;
    border-top: 2px solid var(--mh-border);
    flex-shrink: 0;
}

.modern-header__cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 1.125rem;
}

.modern-header__cart-total-label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
}

.modern-header__cart-total-price {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--mh-text-color);
}

.modern-header__cart-btn {
    display: block;
    width: 100%;
    padding: 1rem;
    text-align: center;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--mh-transition);
    border: none;
    cursor: pointer;
}

.modern-header__cart-btn--view {
    background: var(--mh-accent);
    color: var(--mh-secondary);
}

.modern-header__cart-btn--view:hover {
    background: var(--mh-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--mh-accent) 30%, transparent);
}

/* Cart Overlay */
.modern-header__cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--mh-overlay);
    opacity: 0;
    visibility: hidden;
    transition: var(--mh-transition);
    z-index: calc(var(--mh-z-base) + 99);
    backdrop-filter: blur(4px);
}

.modern-header__cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Toggle */
.modern-header__mobile-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: calc(var(--mh-z-base) + 10);
    border-radius: 8px;
    transition: var(--mh-transition);
}

.modern-header__mobile-toggle:hover {
    background: color-mix(in srgb, var(--mh-accent) 8%, transparent);
}

.modern-header__hamburger {
    width: 24px;
    height: 2px;
    background: var(--mh-text-color);
    border-radius: 2px;
    transition: var(--mh-transition);
    transform-origin: center;
}

.modern-header__mobile-toggle.active .modern-header__hamburger:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.modern-header__mobile-toggle.active .modern-header__hamburger:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.modern-header__mobile-toggle.active .modern-header__hamburger:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile Overlay */
.modern-header__mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--mh-overlay);
    opacity: 0;
    visibility: hidden;
    transition: var(--mh-transition);
    z-index: calc(var(--mh-z-base) + 19);
    backdrop-filter: blur(4px);
}

.modern-header__mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Panel */
.modern-header__mobile-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background: var(--mh-secondary);
    box-shadow: 4px 0 24px var(--mh-shadow-lg);
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: calc(var(--mh-z-base) + 20);
    display: flex;
    flex-direction: column;
}

.modern-header__mobile-panel.active {
    transform: translateX(0);
}

.modern-header__mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--mh-border);
}

.modern-header__mobile-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--mh-text-color);
}

.modern-header__mobile-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--mh-text-color);
    cursor: pointer;
    border-radius: 8px;
    transition: var(--mh-transition);
}

.modern-header__mobile-close:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    transform: rotate(90deg);
}

.modern-header__mobile-menu {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    list-style: none;
    margin: 0;
}

.modern-header__mobile-menu::-webkit-scrollbar {
    width: 6px;
}

.modern-header__mobile-menu::-webkit-scrollbar-track {
    background: transparent;
}

.modern-header__mobile-menu::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.modern-header__mobile-menu-item {
    border-bottom: 1px solid var(--mh-border);
}

.modern-header__mobile-menu-item:last-child {
    border-bottom: none;
}

.modern-header__mobile-menu-link {
    display: flex;
    align-items: center;
    padding: 1.5rem 2rem;
    color: var(--mh-text-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.4rem;
    transition: var(--mh-transition);
    position: relative;
}

.modern-header__mobile-menu-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 70%;
    background: var(--mh-accent);
    transition: width 0.3s ease;
}

.modern-header__mobile-menu-link:hover,
.modern-header__mobile-menu-link:active {
    background: color-mix(in srgb, var(--mh-accent) 5%, transparent);
    color: var(--mh-accent);
    padding-left: 2.5rem;
}

.modern-header__mobile-menu-link:hover::before {
    width: 4px;
}

.modern-header__mobile-menu-link.active {
    background: color-mix(in srgb, var(--mh-accent) 8%, transparent);
    color: var(--mh-accent);
    padding-left: 2.5rem;
}

.modern-header__mobile-menu-link.active::before {
    width: 4px;
}

/* Responsive */
@media (min-width: 992px) {
    .modern-header__mobile-toggle {
        display: none;
    }

    .modern-header__nav {
        display: block;
    }
}

@media (max-width: 991px) {
    .modern-header__container {
        grid-template-columns: auto 1fr auto;
        padding: 0 1.5rem;
        height: 70px;
    }

    .modern-header__logo {
        justify-self: center;
    }

    .modern-header__logo-img {
        height: 38px;
    }

    .modern-header__mobile-toggle {
        justify-self: start;
        order: -1;
    }
}

@media (max-width: 576px) {
    .modern-header__container {
        padding: 0 1rem;
        height: 65px;
    }

    .modern-header__logo-img {
        height: 32px;
    }

    .modern-header__actions {
        gap: 0.5rem;
    }

    .modern-header__action-btn {
        width: 40px;
        height: 40px;
    }

    .modern-header__icon {
        width: 20px;
        height: 20px;
    }
}

/* Animations d'entrée */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modern-header__menu-item {
    animation: fadeInDown 0.5s ease backwards;
}

.modern-header__menu-item:nth-child(1) { animation-delay: 0.05s; }
.modern-header__menu-item:nth-child(2) { animation-delay: 0.1s; }
.modern-header__menu-item:nth-child(3) { animation-delay: 0.15s; }
.modern-header__menu-item:nth-child(4) { animation-delay: 0.2s; }

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible pour l'accessibilité */
.modern-header__menu-link:focus-visible,
.modern-header__action-btn:focus-visible,
.modern-header__mobile-menu-link:focus-visible {
    outline: 3px solid var(--mh-accent);
    outline-offset: 2px;
}
