/**
 * Trove Header CSS
 *
 * Purpose: Styles that Tailwind utility classes can't handle for the
 * Trove header component (scrollbar hiding, dropdown JS states,
 * mobile nav transitions, badge sizing).
 *
 * JS class convention: theme.js uses .active for all toggles.
 */

/* ========================================
   0. Scroll-aware fixed header
   ----------------------------------------
   Hide on scroll down, show on scroll up.
   JS toggles .header-hidden class.
   Uses fixed positioning (not sticky) so
   transform: translateY works correctly.
======================================== */

.trove-header {
    transition: transform 0.3s ease;
    will-change: transform;
}

.trove-header.header-hidden {
    transform: translateY(-100%);
}

/* ========================================
   0b. Force vertical centering in Trove header
   ----------------------------------------
   Base CSS may override Tailwind's items-center.
   These ensure all header content stays centered.
======================================== */

.trove-header,
.trove-header * {
    box-sizing: border-box;
}

.trove-header .flex {
    display: flex !important;
    align-items: center !important;
}

/* Mobile header: hamburger left, logo center, user icon right */
@media (max-width: 1023px) {
    .trove-header .mobile-header-row {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        position: relative;
    }
}

/* Hide mobile-only elements on desktop */
@media (min-width: 1024px) {
    .trove-header .mobile-only {
        display: none !important;
    }
}

/* 3-column grid for desktop header: left (logo) | center (nav) | right (icons) */
@media (min-width: 1024px) {
    .trove-header .header-row {
        display: grid !important;
        grid-template-columns: 1fr auto 1fr;
        align-items: center !important;
    }
}

.trove-header a.flex-shrink-0 {
    display: flex;
    align-items: center;
}

.trove-header a.flex-shrink-0 img {
    display: block;
}

/* ========================================
   1. Application Area Row - Hide Scrollbar
   ----------------------------------------
   Horizontal scroll without visible scrollbar.
======================================== */

.trove-apparea-row {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.trove-apparea-row::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* ========================================
   2. User Dropdown Toggle (hover)
======================================== */

.trove-user-dropdown-menu {
    display: none;
    font-size: 14px !important;
    margin-top: 4px;
}

/* Bridge the gap between button and dropdown so hover doesn't break */
.trove-user-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.trove-user-dropdown-menu a {
    font-size: 14px !important;
    line-height: 1.5 !important;
    padding: 10px 18px !important;
    display: block !important;
}

.trove-user-dropdown-menu p {
    font-size: 14px !important;
    line-height: 1.5 !important;
}

.trove-user-dropdown:hover .trove-user-dropdown-menu {
    display: block;
}

/* ========================================
   3. Search Overlay Toggle
   ----------------------------------------
   JS toggles .active on #search-overlay.
======================================== */

#search-overlay.active {
    display: block !important;
}

/* ========================================
   4. Mobile Nav Drawer
   ----------------------------------------
   JS adds .active class to slide in.
======================================== */

#mobile-nav.active {
    transform: translateX(0);
}

#mobile-nav-overlay.active {
    display: block !important;
}

/* Mobile sidebar +/- expand/collapse */
.mob-submenu {
    display: none;
}
.mob-submenu.mob-open {
    display: block !important;
}
/* + icon: hide vertical line when open (turns + into -) */
.mob-toggle-icon svg line:first-child {
    transition: opacity 0.2s ease;
}
.mob-open > .mob-nav-toggle .mob-toggle-icon svg line:first-child,
.mob-nav-toggle.is-open .mob-toggle-icon svg line:first-child {
    opacity: 0;
}
.mob-nav-toggle .mob-toggle-icon {
    flex-shrink: 0;
}

/* ========================================
   5. Badge Sizing
   ----------------------------------------
   Tailwind doesn't have w-4.5/h-4.5 by default.
======================================== */

.trove-header-icon .absolute,
.trove-header .open-mini-cart .absolute {
    min-width: 18px;
    min-height: 18px;
}

/* ========================================
   6. Mega Menu - full-width hover timing
   ----------------------------------------
   Small delay to prevent accidental close.
======================================== */

.trove-mega-menu {
    transition: opacity 0.15s ease;
}
.mega-panel-scroll {
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}
.mega-panel-scroll::-webkit-scrollbar {
    width: 5px;
}
.mega-panel-scroll::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}
.mega-panel-scroll::-webkit-scrollbar-track {
    background: transparent;
}

/* ========================================
   7. Location Dropdown Overrides (Trove)
   ----------------------------------------
   The base .location-dropdown is in app.css.
   These are Trove-specific tweaks + nearest store styling.
======================================== */

.location-dropdown {
    min-width: 320px;
    z-index: 100;
}

.location-dropdown-header {
    padding: 16px;
}

.location-dropdown-header h4 {
    font-size: 15px;
    margin: 0 0 12px;
}

.location-detect-btn {
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 6px;
}

.location-dropdown-body {
    padding: 16px;
}

.location-input-label {
    font-size: 12px;
}

.location-input {
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 5px;
    height: 32px;
}

.location-apply-btn {
    font-size: 12px;
    padding: 5px 14px;
    border-radius: 5px;
    height: 32px;
    background: #000;
    color: #fff;
}

.location-apply-btn:hover {
    background: #F4AF2D;
}

.location-hint {
    font-size: 12px;
    margin-top: 8px;
}

.nearest-store-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 12px;
    background: #fdf8ee;
    border: 1px solid #F4AF2D33;
    border-radius: 8px;
    font-size: 12px;
    color: #333;
}

.nearest-store-dropdown svg {
    flex-shrink: 0;
    color: #F4AF2D;
}

/* ========================================
   8. Nearest Store Badge (Product Page)
======================================== */

.nearest-store-badge {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: #fdf8ee;
    border: 1px solid #F4AF2D33;
    border-radius: 8px;
    margin-bottom: 16px;
}

.nearest-store-badge.hidden {
    display: none;
}

.nearest-store-badge svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: #F4AF2D;
}

.nearest-store-badge div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ========================================
   9. Mobile Footer Bar Spacing
   ----------------------------------------
   Add bottom padding to body so content
   isn't hidden behind fixed mobile bar.
======================================== */

@media (max-width: 1023px) {
    body {
        padding-bottom: 56px; /* h-14 = 3.5rem = 56px */
    }
}
