/* ============================================
   PUBLIC HEADER - MODERN STYLE (WHITE DOMINANT + CHERRY RED ACCENT)
   ============================================ */

/* ============================================
   HEADER WRAPPER - STICKY PUTIH
   ============================================ */
.public-header-wrapper {
    position: sticky;
    top: 0;
    z-index: 1050;
    background: #FFFFFF;
    border-bottom: 1px solid #E5E7EB;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.3s ease;
    overflow: visible !important;
    isolation: isolate;
}

.public-header-wrapper.scrolled {
    background: #FFFFFF;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ============================================
   HEADER
   ============================================ */
.public-header {
    background: #FFFFFF;
    overflow: visible !important;
    isolation: isolate;
}

/* ============================================
   ROW 1: Logo + Search + Actions
   ============================================ */
.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
    gap: 1rem;
    position: relative;
    z-index: 2;
}

/* Logo */
.header-logo {
    flex-shrink: 0;
}

.header-brand-link {
    display: flex;
    align-items: baseline;
    text-decoration: none;
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #FF4757;
}

.header-brand-link:hover {
    color: #E0394A;
}

.header-brand-dot {
    color: #FFE03D;
    font-weight: 800;
}

/* Search */
.header-search {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 1rem;
    max-width: 600px;
    margin: 0 auto;
    overflow: visible !important;
    z-index: 5;
}

.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 480px;
    overflow: visible !important;
    z-index: 5;
}

.search-wrapper .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9CA3AF;
    font-size: 1.1rem;
    transition: color 0.2s ease;
    z-index: 2;
}

.search-wrapper:focus-within .search-icon {
    color: #FF4757;
}

.search-input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.8rem;
    border: 1.5px solid #E5E7EB;
    border-radius: 50px;
    background: #F9FAFB;
    font-family: var(--font-primary);
    font-size: 0.875rem;
    color: #374151;
    transition: all 0.2s ease;
    outline: none;
}

.search-input::placeholder {
    color: #9CA3AF;
}

.search-input:focus {
    background: #FFFFFF;
    border-color: #FF4757;
    box-shadow: 0 0 0 4px rgba(255, 71, 87, 0.06);
}

.search-input:focus::placeholder {
    color: #D1D5DB;
}

/* Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.header-auth {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.header-auth-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    font-family: var(--font-primary);
    font-size: 0.875rem;
    font-weight: 500;
    color: #6B7280;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.header-auth-link:hover {
    color: #FF4757;
    background: #FFF0F2;
}

.header-auth-link i {
    font-size: 1.1rem;
}

.header-user {
    display: none;
    align-items: center;
    gap: 0.25rem;
}

.header-user.show {
    display: flex;
}

.header-user-greeting {
    font-family: var(--font-primary);
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    padding: 0 0.25rem;
    text-decoration: none;
}

.header-user-greeting:hover {
    color: #FF4757;
}

.header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #6B7280;
    font-size: 1.2rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    text-decoration: none;
}

.header-icon-btn:hover {
    color: #FF4757;
    background: #FFF0F2;
}

.header-cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #6B7280;
    font-size: 1.2rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    text-decoration: none;
}

.header-cart-btn:hover {
    color: #FF4757;
    background: #FFF0F2;
}

.cart-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #FF4757;
    color: #FFFFFF;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 50px;
    border: 2px solid #FFFFFF;
}

.header-mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #374151;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.header-mobile-toggle:hover {
    background: #F3F4F6;
    color: #FF4757;
}

/* ============================================
   ROW 2: BRAND TAGS - FIX STACKING CONTEXT
   ============================================ */
.header-brand-row {
    border-top: 1px solid #F3F4F6;
    background: #F9FAFB;
    overflow: visible !important;
    position: relative;
    z-index: 3;
}

.brand-tags-wrapper {
    display: flex;
    align-items: center;
    overflow: visible !important;
    position: relative;
    z-index: 3;
    padding: 0.25rem 0;
}

.brand-tags-scroll {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: visible !important;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem 0 0.5rem 0;
    flex: 1;
    min-width: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.brand-tags-scroll::-webkit-scrollbar {
    display: none;
}

.brand-tag {
    flex-shrink: 0;
    padding: 0.35rem 1rem;
    font-family: var(--font-primary);
    font-size: 0.8rem;
    font-weight: 500;
    color: #6B7280;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.brand-tag:hover {
    color: #FF4757;
    border-bottom-color: rgba(255, 71, 87, 0.3);
}

.brand-tag.active {
    color: #FF4757;
    border-bottom-color: #FF4757;
    font-weight: 600;
}

.brand-tags-container {
    display: contents;
}

/* Brand Dropdown */
.brand-tag-dropdown {
    position: relative;
    flex-shrink: 0;
    padding: 0.35rem 1rem;
    font-family: var(--font-primary);
    font-size: 0.8rem;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: visible !important;
}

.brand-tag-dropdown:hover {
    color: #FF4757;
    border-bottom-color: rgba(255, 71, 87, 0.3);
}

.brand-tag-dropdown.active {
    color: #FF4757;
    border-bottom-color: #FF4757;
    font-weight: 600;
}

.brand-tag-dropdown .dropdown-arrow {
    font-size: 0.5rem;
    margin-left: 0.2rem;
    transition: transform 0.2s ease;
}

.brand-tag-dropdown[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

/* Brand Dropdown Menu */
.brand-tag-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 160px;
    background: #FFFFFF;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    padding: 0.25rem 0;
    display: none;
    z-index: 9999;
    overflow: visible !important;
}

.brand-tag-dropdown-menu.show {
    display: block;
    animation: dropdownFade 0.2s ease;
}

@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.brand-tag-dropdown-menu .brand-sub-link {
    display: flex;
    align-items: center;
    padding: 0.45rem 1.2rem;
    margin: 0 0.35rem;
    color: #374151;
    font-size: 0.8rem;
    font-weight: 400;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.brand-tag-dropdown-menu .brand-sub-link:first-child {
    margin-top: 0.25rem;
}

.brand-tag-dropdown-menu .brand-sub-link:last-child {
    margin-bottom: 0.25rem;
}

.brand-tag-dropdown-menu .brand-sub-link:hover {
    background: #FFF0F2;
    color: #FF4757;
}

/* Newly Update Dropdown — produk */
.newly-update-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 280px;
    max-width: 360px;
    background: #FFFFFF;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    display: none;
    z-index: 9999;
    overflow: hidden;
    max-height: 400px;
    overflow-y: auto;
}

.newly-update-dropdown.show {
    display: block;
    animation: dropdownFade 0.2s ease;
}

.newly-update-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    margin: 0 0.35rem;
    color: #374151;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.15s ease;
    cursor: pointer;
}

.newly-update-item:hover {
    background: #FFF0F2;
}

.newly-update-item:first-child {
    margin-top: 0.25rem;
}

.newly-update-item:last-child {
    margin-bottom: 0.25rem;
}

.newly-update-img {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #E5E7EB;
    flex-shrink: 0;
    background: #F9FAFB;
}

.newly-update-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
    line-height: 1.3;
}

.newly-update-empty {
    text-align: center;
    padding: 1.5rem 1rem;
    color: #9CA3AF;
    font-size: 0.8rem;
}

/* ============================================
   MOBILE MENU
   ============================================ */
.mobile-menu {
    background: #FFFFFF;
    border-top: 1px solid #F3F4F6;
    padding: 0.5rem 0 1rem;
    display: none;
    position: relative;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.mobile-menu.show {
    display: block;
}

.mobile-menu-items {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mobile-menu-link {
    display: block;
    padding: 0.6rem 0.5rem;
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.mobile-menu-link:hover {
    background: #FFF0F2;
    color: #FF4757;
}

.mobile-divider {
    border: none;
    border-top: 1px solid #F3F4F6;
    margin: 0.25rem 0;
}

/* Mobile Brand Item */
.mobile-brand-item {
    border-bottom: 1px solid #F3F4F6;
}

.mobile-brand-item:last-child {
    border-bottom: none;
}

.mobile-brand-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 0.5rem;
    background: none;
    border: none;
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    border-radius: 8px;
}

.mobile-brand-toggle:hover {
    background: #FFF0F2;
    color: #FF4757;
}

.mobile-brand-toggle i:first-child {
    color: #9CA3AF;
    font-size: 0.8rem;
}

.mobile-brand-toggle .ms-auto {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.mobile-brand-toggle.open .ms-auto {
    transform: rotate(180deg);
}

.mobile-brand-children {
    padding-left: 1.5rem;
    display: none;
}

.mobile-brand-children.show {
    display: block;
}

.mobile-brand-children .mobile-nav-item-link.sub {
    display: block;
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
    color: #6B7280;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.mobile-brand-children .mobile-nav-item-link.sub:hover {
    background: #FFF0F2;
    color: #FF4757;
}

/* Mobile Search Modal */
.mobile-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #FFFFFF;
    z-index: 9999;
    padding: 0.75rem 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: none;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.mobile-search-modal.show {
    display: block;
    transform: translateY(0);
}

.mobile-search-modal .search-input {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.8rem;
    border: 1.5px solid #E5E7EB;
    border-radius: 50px;
    background: #F9FAFB;
    font-size: 1rem;
}

.mobile-search-modal .search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9CA3AF;
    font-size: 1.2rem;
}

.mobile-search-modal .search-close {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6B7280;
    font-size: 1.2rem;
    cursor: pointer;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 991.98px) {
    .header-search {
        max-width: 300px;
        padding: 0 0.5rem;
    }
    
    .search-wrapper {
        max-width: 100%;
    }

    .header-auth-link span {
        display: none;
    }
    
    .header-auth-link i {
        font-size: 1.2rem;
    }
    
    .header-auth-link {
        padding: 0.4rem 0.6rem;
    }

    .header-user-greeting {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .header-row {
        height: 60px;
        gap: 0.5rem;
    }
    
    .header-brand-link {
        font-size: 1.2rem;
    }

    .header-search {
        max-width: 180px;
        padding: 0;
    }

    .search-input {
        padding: 0.4rem 0.8rem 0.4rem 2.2rem;
        font-size: 0.8rem;
        border-radius: 30px;
    }
    
    .search-wrapper .search-icon {
        left: 0.7rem;
        font-size: 0.9rem;
    }

    .header-auth-link {
        padding: 0.3rem 0.4rem;
        font-size: 0.75rem;
    }

    .header-auth-link i {
        font-size: 1rem;
    }

    .header-cart-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .header-icon-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .header-mobile-toggle {
        display: flex;
    }

    .header-brand-row {
        display: none !important;
    }

    .cart-badge {
        min-width: 16px;
        height: 16px;
        font-size: 0.5rem;
    }
}