﻿/* ===========================================
   CANDY STORE HEADER - ENHANCED DESIGN
   =========================================== */

:root {
    --primary: #FFE600;
    --primary-light: #FFF176;
    --primary-dark: #CCB800;
    --dark: #2d2d2d;
    --gray: #666;
    --gray-light: #999;
    --light: #f8f8f8;
    --white: #fff;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.18);
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.35s cubic-bezier(0.4,0,0.2,1);
    --border-radius: 12px;
}

* {
    box-sizing: border-box;
}

/* ===========================================
   HEADER BASE
   =========================================== */

#cx-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--white);
    box-shadow: var(--shadow-md);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

    #cx-header.header-hidden {
        transform: translateY(-100%);
    }

.header {
    max-width: 1480px;
    margin: 0 auto;
}

/* ===========================================
   MAIN HEADER CONTAINER
   =========================================== */

.main-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    gap: 20px;
    background: linear-gradient(180deg, var(--white) 0%, var(--light) 100%);
}

/* ===========================================
   HAMBURGER BUTTON
   =========================================== */

.PreHeader {
    display: none;
}

cx-hamburger-menu {
    display: block;
    line-height: 0;
    flex-shrink: 0;
}

.hamburger-btn {
    display: none;
    width: 40px;
    height: 40px;
    background: #FFE600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    z-index: 10;
}

/* ===========================================
   LOGO & BRAND
   =========================================== */

.SiteLogo {
    flex: 0 0 auto;
    display: flex !important;
    align-items: center;
    justify-content: flex-start !important;
    text-align: left !important;
}

cx-page-slot.SiteLogo {
    display: flex !important;
    justify-content: flex-start !important;
    text-align: left !important;
}

cx-banner {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px;
}

    cx-banner cx-generic-link,
    cx-banner cx-generic-link a {
        display: flex !important;
        align-items: center;
        justify-content: flex-start !important;
    }

.logo-link {
    display: block;
    transition: transform var(--transition-fast);
    margin: 0 !important;
}

    .logo-link:hover {
        transform: scale(1.02);
    }

.main-logo {
    display: block;
    height: 60px;
    width: auto;
    margin: 0 !important;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.brand-feeling {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: #0f1446;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.2;
    white-space: nowrap;
}

/* ===========================================
   SEARCH BAR
   =========================================== */

.SearchBox {
    flex: 1;
    max-width: 400px;
    min-width: 180px;
}

.search-container {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 12px 50px 12px 20px;
    border: 2px solid #e8e8e8;
    border-radius: 50px;
    font-size: 0.9rem;
    color: var(--dark);
    background: var(--white);
    transition: all var(--transition-smooth);
    box-shadow: var(--shadow-sm);
}

    .search-input::placeholder {
        color: var(--gray-light);
        font-style: italic;
    }

    .search-input:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 4px rgba(255,230,0,0.15), var(--shadow-md);
    }

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    border: none;
    color: var(--dark);
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(255,230,0,0.3);
    flex-shrink: 0;
}

    .search-btn:hover {
        transform: translateY(-50%) scale(1.08);
        box-shadow: 0 4px 12px rgba(255,230,0,0.4);
    }

    .search-btn svg {
        width: 18px;
        height: 18px;
    }

.results {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

/* ===========================================
   HEADER ICONS
   =========================================== */

.header-icons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.MiniCart {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark);
    position: relative;
    cursor: pointer;
    transition: all var(--transition-smooth);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

    .icon-btn:hover {
        border-color: #000;
        background: var(--primary);
        color: #000;
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(255,230,0,0.35);
    }

    .icon-btn svg {
        width: 20px;
        height: 20px;
        transition: transform var(--transition-fast);
    }

    .icon-btn:hover svg {
        transform: scale(1.1);
    }

.icon-login:hover {
    background: var(--primary);
    border-color: #000;
    color: #000;
}

.icon-wishlist {
    color: var(--primary);
    border-color: #000;
}

    .icon-wishlist svg {
        fill: var(--primary);
    }

    .icon-wishlist:hover {
        background: var(--primary);
        border-color: #000;
        color: #000;
    }

        .icon-wishlist:hover svg {
            fill: #000;
        }

.icon-cart {
    border-color: #000;
    color: var(--primary);
}

    .icon-cart:hover {
        background: var(--primary);
        border-color: #000;
        color: #000;
    }

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    background: var(--primary);
    color: #000;
    border-radius: 50%;
    font-size: 0.68rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid #000;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

#badge,
#badge_wish_list {
    opacity: 0;
    transition: opacity 0.3s ease;
}

    #badge.is-visible,
    #badge_wish_list.is-visible {
        opacity: 1;
    }

/* ===========================================
   NAVIGATION BAR — DESKTOP
   =========================================== */

.NavigationBar {
    background: var(--white);
    border-top: 1px solid #eee;
    padding: 0 32px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 4px;
}

    .nav-menu > nav,
    .nav-menu > div:not(.back) {
        position: relative;
    }

.back {
    display: none;
}

.header_nav-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}

    .header_nav-wrapper.is-desktop {
        display: flex;
    }

.header_nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    color: var(--dark);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-radius: 50px;
    background: transparent;
    white-space: nowrap;
}

    /* Desktop hover via CSS variable set by JS */
    .header_nav-link:hover {
        background-color: var(--nav-color, #FFE600) !important;
        color: #111111 !important;
    }

a.header_nav-link::after,
a.header_nav-link:hover::after {
    display: none !important;
    content: none !important;
}

/* ===========================================
   SIDEBAR MODALS
   =========================================== */

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1998;
}

    .sidebar-backdrop.active {
        display: block;
    }

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 1999;
    cursor: pointer;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.sidebar-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 440px;
    max-width: 92vw;
    height: 100%;
    background: var(--white);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.45s cubic-bezier(0.32,0.72,0,1);
    box-shadow: -20px 0 60px rgba(0,0,0,0.25);
}

.sidebar-backdrop.active .sidebar-panel {
    transform: translateX(0);
}

.sidebar-header {
    padding: 24px 28px;
    background: var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

    .sidebar-header h2 {
        margin: 0;
        font-size: 1.4rem;
        font-weight: 700;
        color: #000;
    }

.close-sidebar {
    background: rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

    .close-sidebar:hover {
        background: rgba(0,0,0,0.2);
        transform: rotate(90deg) scale(1.1);
    }

    .close-sidebar svg {
        width: 20px;
        height: 20px;
    }

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    background: linear-gradient(180deg, var(--light) 0%, var(--white) 100%);
}

    .sidebar-body::-webkit-scrollbar {
        width: 6px;
    }

    .sidebar-body::-webkit-scrollbar-track {
        background: var(--light);
    }

    .sidebar-body::-webkit-scrollbar-thumb {
        background: var(--primary-light);
        border-radius: 3px;
    }

        .sidebar-body::-webkit-scrollbar-thumb:hover {
            background: var(--primary);
        }

/* ===========================================
   UTILITY
   =========================================== */

.espacio_inicial {
    height: auto;
}

#drop-paises {
    display: none;
}

.cart {
    display: none;
}

.wishlist {
    display: none;
}

/* ===========================================
   MOBILE — max-width: 992px
   =========================================== */

@media (max-width: 992px) {

    .PreHeader {
        display: block;
        flex-shrink: 0;
    }

    .hamburger-btn {
        display: flex;
    }

    .main-header-container {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 12px;
        padding: 10px 16px;
        position: relative;
    }

    .PreHeader {
        grid-column: 1;
    }

    .SiteLogo {
        grid-column: 2;
    }

    .header-icons {
        grid-column: 3;
    }

    /* Logo left-align — override any centering from cx-page-slot */
    .SiteLogo,
    cx-page-slot.SiteLogo {
        display: flex !important;
        justify-content: flex-start !important;
        align-items: center !important;
        text-align: left !important;
        width: 100% !important;
    }

    cx-banner {
        justify-content: flex-start !important;
        width: 100% !important;
    }

    .SearchBox {
        display: none !important;
    }

    /* Nav dropdown */
    .main-header-container .header_nav-wrapper {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0 !important;
        background: #ffffff;
        border-top: 3px solid #FFE600;
        box-shadow: 0 8px 24px rgba(0,0,0,0.12);
        padding: 8px 16px 16px;
        z-index: 999;
    }

    .header_nav-link {
        display: block !important;
        padding: 14px 16px !important;
        border-radius: 10px !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        text-align: left !important;
        border-bottom: 1px solid #f5f5f5 !important;
        color: #2d2d2d !important;
        background: transparent !important;
        white-space: normal !important;
    }

        .header_nav-link:last-child {
            border-bottom: none !important;
        }

    /* Mobile static colors */
    a.header_nav-link[data-nav-color="#FFE600"] {
        background: rgba(255,230,0,0.15) !important;
        border-left: 4px solid #FFE600 !important;
    }

    a.header_nav-link[data-nav-color="#a7cd07"] {
        background: rgba(167,205,7,0.15) !important;
        border-left: 4px solid #a7cd07 !important;
    }

    a.header_nav-link[data-nav-color="#ed3d22"] {
        background: rgba(237,61,34,0.15) !important;
        border-left: 4px solid #ed3d22 !important;
    }

    a.header_nav-link[data-nav-color="#a319c6"] {
        background: rgba(163,25,198,0.15) !important;
        border-left: 4px solid #a319c6 !important;
    }

    .NavigationBar {
        display: none !important;
    }

    .main-logo {
        height: 44px !important;
    }

    cx-banner {
        gap: 8px !important;
    }

    .brand-feeling {
        font-size: 0.72rem !important;
    }

    .icon-btn {
        width: 40px !important;
        height: 40px !important;
    }

        .icon-btn svg {
            width: 18px !important;
            height: 18px !important;
        }

    .MiniCart {
        gap: 6px !important;
    }
}

@media (max-width: 480px) {
    .brand-feeling {
        display: none !important;
    }

    .main-logo {
        height: 36px !important;
    }

    .icon-btn {
        width: 36px !important;
        height: 36px !important;
    }

    .sidebar-panel {
        width: 100%;
        max-width: 100%;
    }
}

cx-hamburger-menu {
    display: none !important;
}

.search-input {
    font-family: 'Poppins', sans-serif !important;
    font-weight: 600 !important;
}