/* ============================================================
   Ventova Store — Header Styles
   Newegg-inspired: Topbar → Main Header → Category Nav
   ============================================================ */

/* ── Top Bar ── */
.vs-topbar {
    background: var(--vs-bg-dark);
    color: var(--vs-text-light);
    font-size: 0.8rem;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.vs-topbar .vs-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vs-topbar-left,
.vs-topbar-right {
    display: flex;
    align-items: center;
    gap: var(--vs-space-lg);
}

.vs-topbar a {
    color: var(--vs-text-light);
    font-size: 0.78rem;
}

.vs-topbar a:hover {
    color: var(--vs-accent);
}

.vs-topbar i {
    margin-right: 4px;
    font-size: 0.75rem;
}

/* Topbar menu (configurable via Apariencia → Menús) */
.vs-topbar-menu {
    display: flex;
    align-items: center;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

.vs-topbar-menu li {
    position: relative;
}

.vs-topbar-menu li + li::before {
    content: "|";
    color: rgba(255, 255, 255, 0.2);
    margin: 0 var(--vs-space-sm);
    font-size: 0.7rem;
}

.vs-topbar-menu li a {
    color: var(--vs-text-light);
    font-size: 0.78rem;
    text-decoration: none;
    transition: color 0.15s ease;
}

.vs-topbar-menu li a:hover {
    color: var(--vs-accent);
}


/* ── Main Header ── */
.vs-header-main {
    background: var(--vs-primary);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--vs-shadow-md);
}

.vs-header-main .vs-container {
    display: flex;
    align-items: center;
    gap: var(--vs-space-lg);
}

/* Logo */
.vs-logo {
    flex-shrink: 0;
}

.vs-logo a {
    display: flex;
    align-items: center;
    gap: var(--vs-space-sm);
    color: #fff;
    font-family: var(--vs-font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    text-decoration: none;
}

.vs-logo img {
    max-height: 45px;
    width: auto;
}

.vs-logo .logo-accent {
    color: var(--vs-accent);
}


/* Search Bar */
.vs-search-bar {
    flex: 1;
    display: flex;
    align-items: stretch;
    height: 40px;
    border-radius: 50px;
    background: #fff;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}

.vs-search-bar .search-input {
    flex: 1;
    border: none;
    padding: 0 1.25rem;
    font-size: 0.9rem;
    font-family: var(--vs-font-body);
    color: var(--vs-text);
    outline: none;
    background: transparent;
    border-radius: 50px 0 0 50px;
}

.vs-search-bar .search-input::placeholder {
    color: var(--vs-text-light);
}

.vs-search-bar .search-btn {
    background: var(--vs-accent);
    border: none;
    width: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--vs-transition-fast);
    color: var(--vs-bg-dark);
    font-size: 1.1rem;
    border-radius: 0 50px 50px 0;
}

.vs-search-bar .search-btn:hover {
    background: var(--vs-accent-hover);
}

/* Search Results Dropdown */
.vs-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--vs-bg-white);
    border-radius: 0 0 var(--vs-radius-md) var(--vs-radius-md);
    box-shadow: var(--vs-shadow-lg);
    border: 1px solid var(--vs-border);
    border-top: none;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}

.vs-search-results.active {
    display: block;
}


/* Header Icons */
.vs-header-icons {
    display: flex;
    align-items: center;
    gap: var(--vs-space-sm);
    flex-shrink: 0;
}

.vs-header-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.7rem;
    padding: 6px 10px;
    border-radius: var(--vs-radius-md);
    transition: var(--vs-transition-fast);
    cursor: pointer;
    text-decoration: none;
    position: relative;
    background: transparent;
    border: none;
}

.vs-header-icon:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.vs-header-icon i {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.vs-header-icon .icon-badge {
    position: absolute;
    top: 0;
    right: 2px;
    background: var(--vs-accent);
    color: var(--vs-bg-dark);
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: var(--vs-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}


/* ── Category Navigation ── */
.vs-nav-categories {
    background: var(--vs-primary-dark);
    border-bottom: 3px solid var(--vs-accent);
}

.vs-nav-categories .vs-container {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.vs-nav-categories .vs-container::-webkit-scrollbar {
    display: none;
}

.vs-nav-link {
    display: flex;
    align-items: center;
    gap: var(--vs-space-sm);
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    transition: var(--vs-transition-fast);
    border-bottom: 2px solid transparent;
}

.vs-nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-bottom-color: var(--vs-accent);
}

.vs-nav-link i {
    font-size: 0.9rem;
    color: var(--vs-accent);
}


/* ── Mobile Menu Toggle ── */
.vs-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 6px;
}


/* ── Mini Cart Dropdown ── */
.vs-minicart-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    background: var(--vs-bg-white);
    border-radius: var(--vs-radius-lg);
    box-shadow: var(--vs-shadow-lg);
    border: 1px solid var(--vs-border);
    padding: var(--vs-space-lg);
    display: none;
    z-index: 200;
}

.vs-minicart-dropdown.active {
    display: block;
    animation: vsSlideDown 0.2s ease;
}

@keyframes vsSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vs-minicart-item {
    display: flex;
    gap: var(--vs-space-sm);
    padding: var(--vs-space-sm) 0;
    border-bottom: 1px solid var(--vs-border-light);
}

.vs-minicart-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: var(--vs-radius-sm);
}

.vs-minicart-item-info {
    flex: 1;
}

.vs-minicart-item-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--vs-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vs-minicart-item-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--vs-primary);
}

.vs-minicart-total {
    display: flex;
    justify-content: space-between;
    padding: var(--vs-space-md) 0;
    font-weight: 700;
    font-size: 1rem;
    border-top: 2px solid var(--vs-border);
    margin-top: var(--vs-space-sm);
}

.vs-minicart-actions {
    display: flex;
    flex-direction: column;
    gap: var(--vs-space-sm);
    margin-top: var(--vs-space-md);
}


/* ── Category Mega Menu ── */

/* Nav bar must be the positioning parent for the floating panel */
.vs-nav-categories {
    position: relative;
}

/* ── Trigger button ── */
.vs-catmenu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px;
    height: 100%;
    min-height: 40px;
    background: var(--vs-accent);
    color: var(--vs-bg-dark);
    border: none;
    cursor: pointer;
    font-family: var(--vs-font-body);
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s ease;
    align-self: stretch;
}

.vs-catmenu-trigger:hover {
    background: var(--vs-accent-hover);
}

.vs-catmenu-trigger-bars {
    display: flex;
    flex-direction: column;
    gap: 3.5px;
    flex-shrink: 0;
}

.vs-catmenu-trigger-bars span {
    display: block;
    width: 15px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.vs-catmenu-chevron {
    font-size: 0.68rem;
    transition: transform 0.22s ease;
    margin-left: 2px;
}

.vs-catmenu-trigger[aria-expanded="true"] .vs-catmenu-chevron {
    transform: rotate(180deg);
}

/* Animate bars to X when open */
.vs-catmenu-trigger[aria-expanded="true"] .vs-catmenu-trigger-bars span:nth-child(1) {
    transform: translateY(5.5px) rotate(45deg);
}
.vs-catmenu-trigger[aria-expanded="true"] .vs-catmenu-trigger-bars span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.vs-catmenu-trigger[aria-expanded="true"] .vs-catmenu-trigger-bars span:nth-child(3) {
    transform: translateY(-5.5px) rotate(-45deg);
}

/* ── Panel (floats below nav bar, full width) ── */
.vs-catmenu-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 900;
    display: flex;
    background: var(--vs-bg-white);
    border-top: 2px solid var(--vs-accent);
    border-bottom: 1px solid var(--vs-border);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    max-height: 460px;
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
    pointer-events: none;
}

.vs-catmenu-panel.vs-catmenu-panel--open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* ── Left column — parent categories ── */
.vs-catmenu-left {
    width: 230px;
    flex-shrink: 0;
    background: var(--vs-primary-dark);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
    padding: 6px 0;
}

.vs-catmenu-item {
    cursor: default;
}

.vs-catmenu-item-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.84rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease, border-left-color 0.12s ease;
    border-left: 3px solid transparent;
}

.vs-catmenu-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vs-catmenu-main-icon {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.12s ease;
    flex-shrink: 0;
}

.vs-catmenu-main-icon-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
    transition: transform 0.15s ease;
    filter: brightness(0) invert(1) opacity(0.7); /* Optional: makes dark icons white/transparent to match the dark menu */
}

.vs-catmenu-chevron-icon {
    font-size: 0.65rem;
    opacity: 0.4;
    transition: opacity 0.12s ease, transform 0.12s ease;
    flex-shrink: 0;
}

.vs-catmenu-item:hover .vs-catmenu-item-link,
.vs-catmenu-item--active .vs-catmenu-item-link {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--vs-accent);
}

.vs-catmenu-item:hover .vs-catmenu-main-icon,
.vs-catmenu-item--active .vs-catmenu-main-icon {
    color: #fff;
}

.vs-catmenu-item:hover .vs-catmenu-main-icon-img,
.vs-catmenu-item--active .vs-catmenu-main-icon-img {
    transform: scale(1.1);
    filter: brightness(0) invert(1) opacity(1);
}

.vs-catmenu-item:hover .vs-catmenu-chevron-icon,
.vs-catmenu-item--active .vs-catmenu-chevron-icon {
    opacity: 1;
    transform: translateX(2px);
}

.vs-catmenu-item--no-children .vs-catmenu-item-link .vs-catmenu-chevron-icon {
    display: none;
}

/* ── Right column — subcategories ── */
.vs-catmenu-right {
    flex: 1;
    background: var(--vs-bg-white);
    overflow-y: auto;
    position: relative;
}

.vs-catmenu-sub {
    display: none;
    padding: var(--vs-space-lg) var(--vs-space-xl);
    position: absolute;
    inset: 0;
    overflow-y: auto;
}

.vs-catmenu-sub--active {
    display: block;
    animation: vsCatSubReveal 0.18s ease;
}

@keyframes vsCatSubReveal {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: translateX(0);   }
}

.vs-catmenu-sub-title {
    margin: 0 0 var(--vs-space-md) 0;
    padding-bottom: var(--vs-space-sm);
    border-bottom: 2px solid var(--vs-accent);
    display: inline-block;
}

.vs-catmenu-sub-title a {
    font-family: var(--vs-font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--vs-text);
    text-decoration: none;
}

.vs-catmenu-sub-title a:hover {
    color: var(--vs-primary);
}

.vs-catmenu-sub-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 2px var(--vs-space-md);
}

.vs-catmenu-sub-link {
    display: block;
    padding: 7px 6px;
    color: var(--vs-text-muted);
    font-size: 0.84rem;
    text-decoration: none;
    border-radius: var(--vs-radius-sm);
    transition: background 0.12s ease, color 0.12s ease, padding-left 0.12s ease;
}

.vs-catmenu-sub-link:hover {
    color: var(--vs-primary);
    background: var(--vs-border-light);
    padding-left: 10px;
}

.vs-catmenu-sub-viewall {
    color: var(--vs-primary);
    font-weight: 600;
    font-size: 0.82rem;
    margin-top: var(--vs-space-sm);
    grid-column: 1 / -1;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.vs-catmenu-sub-viewall:hover {
    color: var(--vs-primary-dark);
    background: transparent;
    padding-left: 6px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .vs-topbar {
        display: none;
    }

    .vs-menu-toggle {
        display: block;
    }

    .vs-search-bar .search-category {
        display: none;
    }

    .vs-header-main .vs-container {
        flex-wrap: wrap;
    }

    .vs-search-bar {
        order: 3;
        width: 100%;
        margin-top: 8px;
    }

    .vs-header-icon span {
        display: none;
    }

    .vs-nav-categories .vs-container {
        gap: 0;
        padding: 0 var(--vs-space-sm);
    }

    .vs-nav-link {
        padding: 8px 12px;
        font-size: 0.78rem;
    }

    .vs-minicart-dropdown {
        width: 100%;
        position: fixed;
        top: auto;
        bottom: calc(56px + env(safe-area-inset-bottom, 0));
        left: 0;
        right: 0;
        border-radius: var(--vs-radius-lg) var(--vs-radius-lg) 0 0;
        max-height: 60vh;
        overflow-y: auto;
        z-index: 99998;
    }

    /* Mega menu: hide on mobile (cats accessible via horizontal scroll) */
    .vs-catmenu-trigger {
        display: none;
    }

    .vs-catmenu-panel {
        display: none;
    }
}


/* ── Mobile Drawer (slide from right) ── */

/* Overlay */
.vs-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.vs-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Drawer panel */
.vs-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    max-width: 85vw;
    height: 100%;
    background: var(--vs-bg-white);
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vs-drawer.open {
    transform: translateX(0);
}

/* Drawer header */
.vs-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--vs-primary);
    color: #fff;
    flex-shrink: 0;
}

.vs-drawer-title {
    font-family: var(--vs-font-heading);
    font-size: 1.1rem;
    font-weight: 700;
}

.vs-drawer-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 1.1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.vs-drawer-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Drawer nav content */
.vs-drawer-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
}

.vs-drawer-section-title {
    padding: 0.75rem 1.25rem 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--vs-text-light);
    border-top: 1px solid var(--vs-border-light);
    margin-top: 0.5rem;
}

.vs-drawer-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.7rem 1.25rem;
    color: var(--vs-text);
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.12s ease, padding-left 0.12s ease;
}

.vs-drawer-link:hover {
    background: var(--vs-border-light);
    padding-left: 1.5rem;
    color: var(--vs-primary);
}

.vs-drawer-link i {
    width: 20px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--vs-text-muted);
    flex-shrink: 0;
}

/* Account link — highlighted */
.vs-drawer-link--account {
    background: var(--vs-border-light);
    font-weight: 600;
    border-bottom: 1px solid var(--vs-border);
}

.vs-drawer-link--account i {
    color: var(--vs-primary);
}

/* Prevent body scroll when drawer is open */
body.vs-drawer-open {
    overflow: hidden;
}