/*
 * EcomFlow - Header & Layout CSS
 * Extracted from header.php inline <style> block.
 * Contains: site header, nav icons, cart drawer, header layout
 *
 * Target: < 10KB minified
 */

/* ===== Site Header ===== */
.site-header {
    background: var(--header-bg-color) !important;
    color: var(--header-text-color) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 0 !important;
    transition: all 0.3s ease;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.site-header.header-scrolled {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.site-header .container {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    height: 50px !important;
    display: flex !important;
    align-items: center !important;
}

/* ===== Header Main Layout ===== */
.header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    gap: 1rem;
}

.site-logo img {
    height: auto;
    max-height: 40px;
    width: auto;
}

/* ===== Mobile Menu Toggle ===== */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--header-text-color);
    padding: 0.25rem;
}
.mobile-menu-close {
    display: none;
}

/* ===== Main Navigation ===== */
.main-navigation ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1.5rem;
}
.main-navigation a {
    display: block;
    text-decoration: none;
    color: var(--header-text-color);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.5rem 0;
    transition: color 0.2s;
}
.main-navigation a:hover,
.main-navigation .current-menu-item > a {
    color: var(--primary-color);
}

/* ===== Header Actions ===== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.header-search,
.header-cart {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--header-text-color);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.header-search:hover,
.header-cart:hover {
    color: var(--primary-color) !important;
}

/* Cart Badge */
.cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--primary-color);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Header Top Bar (Announcement) ===== */
.header-top-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    overflow: hidden;
    position: relative;
    font-size: 0.85rem;
    font-weight: 500;
    min-height: 36px;
}
.header-top-bar__viewport {
    flex: 1;
    overflow: hidden;
}
.header-top-bar__track {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 22px;
}
.header-top-bar__item {
    display: none;
    margin: 0;
    white-space: nowrap;
    line-height: 1.5;
}
.header-top-bar__item.is-active {
    display: block;
}
.header-top-bar__btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
    opacity: 0.8;
}
.header-top-bar__btn:hover {
    opacity: 1;
}
.header-top-bar[data-behavior="marquee"] .header-top-bar__track {
    display: block;
    position: relative;
    overflow: hidden;
    width: 100%;
}
.header-top-bar[data-behavior="marquee"] .header-top-bar__item {
    display: none !important;
}
.header-top-bar[data-behavior="marquee"] .header-top-bar__marquee {
    display: block;
    position: absolute;
    white-space: nowrap;
    will-change: transform;
}
.header-top-bar[data-behavior="static"] .header-top-bar__viewport {
    display: flex;
    justify-content: center;
}

@media (max-width: 768px) {
    .header-top-bar {
        font-size: 0.78rem;
        padding: 0.35rem 0.5rem;
        min-height: 30px;
    }
    .header-top-bar__btn svg {
        width: 14px;
        height: 14px;
    }
    .header-top-bar__viewport {
        max-width: 100%;
    }
}

/* ===== Menu Overlay ===== */
.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===== Mobile Header Styles ===== */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    .mobile-menu-close {
        display: flex;
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--header-text-color);
        padding: 0.5rem;
        z-index: 10;
    }
    .main-navigation {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: #fff;
        box-shadow: -4px 0 12px rgba(0,0,0,0.1);
        z-index: 10001;
        padding: 4rem 1.5rem 1.5rem;
        transition: right 0.3s ease;
        overflow-y: auto;
        pointer-events: auto;
    }
    .main-navigation.menu-open {
        right: 0;
    }
    .main-navigation ul {
        flex-direction: column;
        gap: 0;
    }
    .main-navigation a {
        padding: 0.85rem 0;
        border-bottom: 1px solid #e5e7eb;
        font-size: 1rem;
    }
}

/* ===== Legacy Navigation Icons (dz- prefixed, kept for backward compat) ===== */
.dz-nav-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    color: var(--header-text-color) !important;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.dz-nav-icon-btn:hover {
    background: var(--primary-color);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.dz-nav-icon-btn .dashicons { font-size: 20px; width: 20px; height: 20px; }
.dz-nav-icon-btn:active { transform: scale(0.95); }

/* Legacy Cart Badge (dz- prefix) */
.dz-cart-count {
    position: absolute;
    top: -2px; right: -2px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ===== Site Brand ===== */
.site-brand {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--header-text-color) !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}
.site-brand img { height: 35px; width: auto; }

/* ===== Header Styles Override ===== */
.site-header .dz-nav-icon-btn,
.site-header .dz-menu-toggle,
.site-header .dz-search-toggle,
.site-header .dz-account-toggle,
.site-header .dz-cart-toggle,
.site-header button,
.site-header a { color: var(--header-text-color) !important; }
.site-header svg {
    color: var(--header-text-color) !important;
    stroke: var(--header-text-color) !important;
    width: 18px !important;
    height: 18px !important;
}

/* Header Minimal */
.header-minimal {
    padding: 5px 0 !important;
    backdrop-filter: blur(10px);
}
.header-minimal .site-brand { font-size: 1.2rem !important; }

/* ===== Force Width Fix ===== */
.container {
    max-width: 1200px !important;
    width: 100% !important;
    margin-right: auto !important;
    margin-left: auto !important;
}
.product-page-container {
    max-width: 1200px !important;
    margin-right: auto !important;
    margin-left: auto !important;
}

/* ===== Cart Drawer Theme Matching ===== */
#dz-cart-drawer {
    background-color: var(--bg-light, #ffffff) !important;
    color: var(--text-dark, #1f2937) !important;
}
#dz-cart-drawer .bg-white { background-color: transparent !important; }
#dz-cart-drawer .bg-gray-50\/50,
#dz-cart-drawer .border-gray-100,
#dz-cart-drawer .border-t,
#dz-cart-drawer .border-b {
    background-color: rgba(128,128,128,0.05) !important;
    border-color: rgba(128,128,128,0.1) !important;
}
#dz-cart-drawer .text-gray-800,
#dz-cart-drawer .text-gray-400 { color: inherit !important; opacity: 0.9; }
#dz-cart-drawer .hover\:bg-gray-100:hover { background-color: rgba(128,128,128,0.1) !important; }

/* ===== Product Page Cart UI Overrides ===== */
.product-page-form .bg-white,
.order-form-box .bg-white {
    background: transparent !important;
    border: 1px solid rgba(128,128,128,0.1) !important;
    padding: 15px !important;
}
.product-page-form .flex.items-center.gap-4,
.order-form-box .flex.items-center.gap-4 {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 15px !important;
    margin-bottom: 20px !important;
    flex-wrap: nowrap !important;
}
.product-page-form .border-gray-200,
.order-form-box .border-gray-200 {
    display: flex !important;
    align-items: center !important;
    background: rgba(128,128,128,0.08) !important;
    border-radius: 12px !important;
    border: 1px solid rgba(128,128,128,0.2) !important;
    flex-shrink: 0 !important;
}
.product-page-form button.px-4,
.order-form-box button.px-4 {
    width: 40px !important; height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    color: inherit !important;
    padding: 0 !important;
}
#dz-product-qty {
    width: 40px !important;
    text-align: center !important;
    font-size: 16px !important;
    font-weight: bold !important;
    background: transparent !important;
    border: none !important;
    color: inherit !important;
    padding: 0 !important;
    pointer-events: none;
    -moz-appearance: textfield;
}
#dz-product-qty::-webkit-outer-spin-button,
#dz-product-qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.product-page-form .flex-1.text-right,
.order-form-box .flex-1.text-right {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    justify-content: center !important;
    text-align: right !important;
}
#dz-total-preview {
    font-size: 20px !important;
    font-weight: 900 !important;
    color: var(--primary-color) !important;
    line-height: 1.2 !important;
}

/* ===== Form Themes ===== */
form.form-theme-classic input,
form.form-theme-classic select,
form.form-theme-classic textarea {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}
form.form-theme-modern input,
form.form-theme-modern select,
form.form-theme-modern textarea {
    border: 1px solid transparent !important;
    border-radius: 20px !important;
    background: #f1f5f9 !important;
    padding: 16px 20px !important;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.02) !important;
    transition: all 0.3s ease !important;
}
form.form-theme-modern input:focus,
form.form-theme-modern select:focus,
form.form-theme-modern textarea:focus {
    background: #fff !important;
    border-color: rgba(59, 130, 246, 0.2) !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05) !important;
    transform: translateY(-1px);
}
form.form-theme-floating input,
form.form-theme-floating select,
form.form-theme-floating textarea {
    border: none !important;
    border-bottom: 2px solid #e2e8f0 !important;
    border-radius: 8px 8px 0 0 !important;
    background: #f8fafc !important;
    padding: 16px 16px 12px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
form.form-theme-floating input:focus,
form.form-theme-floating select:focus,
form.form-theme-floating textarea:focus {
    border-bottom-color: var(--primary-color) !important;
    background: #fff !important;
    box-shadow: 0 10px 20px -5px rgba(0,0,0,0.1) !important;
    transform: translateY(-2px);
}

/* ===== Dark Elegance Overrides ===== */
body[data-preset="dark_elegance"], body.preset-dark_elegance {
    background-color: var(--bg-light) !important;
    color: var(--text-dark) !important;
}
body[data-preset="dark_elegance"] .site-header,
body[data-preset="dark_elegance"] .product-details,
body[data-preset="dark_elegance"] .product-card,
body[data-preset="dark_elegance"] .order-form-box,
body.preset-dark_elegance .site-header,
body.preset-dark_elegance .product-details,
body.preset-dark_elegance .product-card,
body.preset-dark_elegance .order-form-box {
    background: var(--white) !important;
    border-color: #333 !important;
    color: var(--text-dark) !important;
}
body[data-preset="dark_elegance"] .btn-primary,
body.preset-dark_elegance .btn-primary {
    background: var(--primary-color) !important;
    color: #121212 !important;
    border: none !important;
}

/* ===== Additional Utilities ===== */
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.italic { font-style: italic; }
.transition-all { transition: all 0.3s ease; }
.transition-colors { transition: color 0.3s ease, background-color 0.3s ease; }
.hover\:text-primary:hover { color: var(--primary-color) !important; }
.bg-gray-50\/50 { background-color: rgba(249, 250, 251, 0.5); }
.max-w-\[400px\] { max-width: 400px; }
.flex-1 { flex: 1 1 0%; }
.bg-primary-light { background-color: var(--bg-primary-light); }
.shadow-primary-soft { box-shadow: 0 10px 15px -3px var(--bg-primary-light) !important; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }

/* ===== Responsive Header ===== */
@media (max-width: 640px) {
    .site-header { padding: 0 !important; }
    .site-header .container { padding-top: 2px !important; padding-bottom: 2px !important; }
}

/* =====================================================
   DARK PRESET — Header Complete Overrides
   ===================================================== */

/* Dark Elegance */
body[data-preset="dark_elegance"] .site-header,
body.preset-dark_elegance .site-header {
    background: #1e293b !important;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2) !important;
}
body[data-preset="dark_elegance"] .site-header a,
body[data-preset="dark_elegance"] .site-header button,
body[data-preset="dark_elegance"] .main-navigation a,
body[data-preset="dark_elegance"] .mobile-menu-toggle,
body[data-preset="dark_elegance"] .header-search,
body[data-preset="dark_elegance"] .header-cart,
body[data-preset="dark_elegance"] .site-brand,
body.preset-dark_elegance .site-header a,
body.preset-dark_elegance .site-header button,
body.preset-dark_elegance .main-navigation a,
body.preset-dark_elegance .mobile-menu-toggle,
body.preset-dark_elegance .header-search,
body.preset-dark_elegance .header-cart,
body.preset-dark_elegance .site-brand {
    color: #f1f5f9 !important;
}
body[data-preset="dark_elegance"] .site-header svg,
body.preset-dark_elegance .site-header svg {
    color: #f1f5f9 !important;
    stroke: #f1f5f9 !important;
}
body[data-preset="dark_elegance"] .main-navigation,
body.preset-dark_elegance .main-navigation {
    background: #1e293b !important;
}
body[data-preset="dark_elegance"] .main-navigation a:hover,
body.preset-dark_elegance .main-navigation a:hover {
    color: #d4af37 !important;
}

/* Modern Neon */
body[data-preset="modern"] .site-header,
body.preset-modern .site-header {
    background: rgba(15, 15, 26, 0.95) !important;
    border-bottom: 1px solid rgba(168, 85, 247, 0.2) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
}
body[data-preset="modern"] .site-header a,
body[data-preset="modern"] .site-header button,
body[data-preset="modern"] .main-navigation a,
body[data-preset="modern"] .mobile-menu-toggle,
body[data-preset="modern"] .header-search,
body[data-preset="modern"] .header-cart,
body[data-preset="modern"] .site-brand,
body.preset-modern .site-header a,
body.preset-modern .site-header button,
body.preset-modern .main-navigation a,
body.preset-modern .mobile-menu-toggle,
body.preset-modern .header-search,
body.preset-modern .header-cart,
body.preset-modern .site-brand {
    color: #e2e8f0 !important;
}
body[data-preset="modern"] .site-header svg,
body.preset-modern .site-header svg {
    color: #e2e8f0 !important;
    stroke: #e2e8f0 !important;
}
body[data-preset="modern"] .main-navigation,
body.preset-modern .main-navigation {
    background: rgba(15, 15, 26, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
}
body[data-preset="modern"] .main-navigation a:hover,
body.preset-modern .main-navigation a:hover {
    color: #c4b5fd !important;
}
