/*!
 * Modern Apple-Style Header CSS for NX-Commerz
 * 
 * Features:
 * - Clean, minimal Apple-inspired design
 * - Glassmorphism effects and modern typography
 * - Responsive and mobile-first approach
 * - Smooth animations and micro-interactions
 * - App-like mobile navigation
 * 
 * Version: 1.0.0
 */

/* ========================================================================
   CSS CUSTOM PROPERTIES - APPLE HEADER THEME
   ======================================================================== */

:root {
    /* Apple Header Colors - Inherit from Server Theme */
    --nx-header-bg: rgba(255, 255, 255, 0.95);
    --nx-header-border: rgba(0, 0, 0, 0.08);
    --nx-header-text: var(--text-primary, #1d1d1f);
    --nx-header-text-secondary: var(--text-secondary, #6e6e73);
    --nx-header-accent: var(--primary, var(--bs-primary, #0071e3));
    
    /* Apple Typography */
    --nx-header-font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
    --nx-header-font-weight-regular: 400;
    --nx-header-font-weight-medium: 500;
    --nx-header-font-weight-semibold: 600;
    
    /* Apple Spacing */
    --nx-header-padding: clamp(0.75rem, 2vw, 1.5rem);
    --nx-header-height: 60px;
    --nx-topbar-height: 32px;
    --nx-nav-height: 48px;
    
    /* Apple Animations */
    --nx-header-transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --nx-header-hover-transition: all 0.15s ease-out;
    
    /* Apple Shadows */
    --nx-header-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --nx-header-shadow-scroll: 0 2px 12px rgba(0, 0, 0, 0.15);
    
    /* Theme Color Integration */
    --nx-primary-rgb: 13, 110, 253; /* Default fallback, will be overridden by server theme */
    --nx-header-accent-light: color-mix(in srgb, var(--nx-header-accent) 10%, transparent);
    --nx-header-accent-hover: var(--primary-hover, color-mix(in srgb, var(--nx-header-accent) 90%, black));
    
    /* Mobile */
    --nx-mobile-header-height: 56px;
    --nx-mobile-search-height: 48px;
    --nx-mobile-nav-width: min(320px, 85vw);
    
    /* Input Styling Variables */
    --nx-input-focus-ring: 0 0 0 4px color-mix(in srgb, var(--bs-primary, var(--primary, #0071e3)) 12%, transparent);
    --nx-input-hover-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --nx-input-focus-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ========================================================================
   GENERAL INPUT STYLES - APPLE DESIGN WITH THEME COLORS
   ======================================================================== */

/* Universal Input Styling for Header */
.nx-header input[type="text"],
.nx-header input[type="search"],
.nx-header input[type="email"],
.nx-header input[type="password"] {
    /* Base Styling */
    font-family: var(--nx-header-font);
    font-weight: var(--nx-header-font-weight-regular);
    font-size: 16px; /* Prevent zoom on iOS */
    line-height: 1.5;
    
    /* Apple-style borders and backgrounds */
    border: 2px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.9);
    border-radius: clamp(12px, 2vw, 24px);
    
    /* Smooth transitions */
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    outline: none;
    
    /* Remove default styling */
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

/* Focus State - Theme Color Integration */
.nx-header input[type="text"]:focus,
.nx-header input[type="search"]:focus,
.nx-header input[type="email"]:focus,
.nx-header input[type="password"]:focus {
    border-color: var(--bs-primary, var(--primary, #0071e3));
    background: white;
    box-shadow: var(--nx-input-focus-ring), var(--nx-input-focus-shadow);
    transform: translateY(-1px);
}

/* Hover State */
.nx-header input[type="text"]:hover:not(:focus),
.nx-header input[type="search"]:hover:not(:focus),
.nx-header input[type="email"]:hover:not(:focus),
.nx-header input[type="password"]:hover:not(:focus) {
    border-color: rgba(0, 0, 0, 0.15);
    background: white;
    box-shadow: var(--nx-input-hover-shadow);
}

/* Placeholder Styling */
.nx-header input::placeholder {
    color: var(--nx-header-text-secondary);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.nx-header input:focus::placeholder {
    opacity: 0.4;
    transform: translateX(4px);
}

/* Error State */
.nx-header input.error,
.nx-header input:invalid {
    border-color: #ff3b30;
    box-shadow: 0 0 0 4px color-mix(in srgb, #ff3b30 12%, transparent);
}

/* Success State */
.nx-header input.success,
.nx-header input:valid {
    border-color: #30d158;
}

/* Disabled State */
.nx-header input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.05);
}

/* ========================================================================
   MODERN TOPBAR STYLES
   ======================================================================== */

.nx-topbar {
    /* Use theme primary color as solid background */
    background: var(--bs-primary, var(--primary, #0071e3));
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-family: var(--nx-header-font);
    font-size: 13px;
    font-weight: var(--nx-header-font-weight-regular);
    position: relative;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nx-topbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--nx-topbar-height);
}

.nx-topbar .nx-topbar-content {
    color: white;
}

.nx-topbar .nx-topbar-content * {
    color: inherit;
}

.nx-container {
    max-width: min(1280px, 100vw - 2rem);
    margin: 0 auto;
    padding-inline: var(--nx-header-padding);
}

/* Contact Link */
.nx-contact-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--nx-header-text);
    text-decoration: none;
    font-weight: var(--nx-header-font-weight-medium);
    transition: var(--nx-header-hover-transition);
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
}

.nx-topbar .nx-contact-link {
    color: white;
}

.nx-topbar .nx-contact-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.nx-contact-text {
    font-variant-numeric: tabular-nums;
}

.nx-topbar .nx-contact-text {
    color: white;
}

/* Topbar Navigation */
.nx-topbar-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nx-topbar-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nx-topbar-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--nx-header-text-secondary);
    text-decoration: none;
    font-weight: var(--nx-header-font-weight-regular);
    transition: var(--nx-header-hover-transition);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    white-space: nowrap;
}

.nx-topbar .nx-topbar-link {
    color: rgba(255, 255, 255, 0.9);
}

.nx-topbar .nx-topbar-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.15);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Social Links */
.nx-social-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nx-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--nx-header-text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: var(--nx-header-hover-transition);
    background: rgba(0, 0, 0, 0.02);
}

.nx-topbar .nx-social-link {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.1);
}

.nx-topbar .nx-social-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Icons */
.nx-icon {
    flex-shrink: 0;
    stroke-width: 2;
}

.nx-topbar .nx-icon {
    color: white;
    stroke: currentColor;
}

/* ========================================================================
   MODERN HEADER STYLES
   ======================================================================== */

.nx-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    font-family: var(--nx-header-font);
}

.nx-desktop-header {
    background: var(--nx-header-bg);
    border-bottom: 1px solid var(--nx-header-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: var(--nx-header-transition);
}

.nx-header-content {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 2rem;
    min-height: var(--nx-header-height);
    padding-block: 0.75rem;
}

/* Logo Section */
.nx-header-logo {
    display: flex;
    align-items: center;
}

.nx-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: var(--nx-header-hover-transition);
    border-radius: 0.5rem;
    padding: 0.25rem;
}

.nx-logo-link:hover {
    transform: scale(1.02);
}

.nx-logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

/* Search Section – stacking context so results appear over nav bar; keep dropdown close to input */
.nx-header-search {
    max-width: 600px;
    position: relative;
    z-index: 1001;
    overflow: visible;
}

.nx-search-form {
    position: relative;
    width: 100%;
}

.nx-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    overflow: visible;
}

.nx-search-input {
    width: 100%;
    height: 44px;
    padding: 0 3.5rem 0 0; /* Remove left padding, use text-indent instead */
    text-indent: 4rem; /* Force text to start after icon */
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.9);
    font-family: var(--nx-header-font);
    font-size: 16px;
    font-weight: var(--nx-header-font-weight-regular);
    color: var(--nx-header-text);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    outline: 1px solid rgba(0, 0, 0, 0.1);
    outline-offset: -1px;
}

.nx-search-input::placeholder {
    color: var(--nx-header-text-secondary);
    opacity: 0.6;
    transition: all 0.3s ease;
}

/* Focus State - Apple Style with Theme Color */
.nx-search-input:focus {
    border-color: var(--bs-primary, var(--primary, #0071e3));
    background: white;
    box-shadow: 
        0 0 0 4px color-mix(in srgb, var(--bs-primary, var(--primary, #0071e3)) 12%, transparent),
        0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.nx-search-input:focus::placeholder {
    opacity: 0.4;
    transform: translateX(4px);
}

/* Hover State */
.nx-search-input:hover:not(:focus) {
    border-color: rgba(0, 0, 0, 0.15);
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Blur State - Return to default smoothly */
.nx-search-input:not(:focus) {
    transition-delay: 0.1s;
}

.nx-search-icon {
    position: absolute;
    left: 1rem; /* Position icon properly */
    top: 50%;
    transform: translateY(-50%); /* Perfect vertical centering */
    color: var(--nx-header-text-secondary);
    pointer-events: none;
    z-index: 10; /* Higher z-index to stay above input */
    transition: all 0.3s ease;
    flex-shrink: 0; /* Prevent icon from shrinking */
}

/* Search icon changes color when input is focused */
.nx-search-input:focus + .nx-search-icon,
.nx-search-input-wrapper:focus-within .nx-search-icon {
    color: var(--bs-primary, var(--primary, #0071e3));
    transform: translateY(-50%) scale(1.1); /* Maintain centering while scaling */
}

.nx-search-submit {
    position: absolute;
    right: 0.5rem; /* More space from edge */
    top: 50%;
    transform: translateY(-50%); /* Perfect vertical centering */
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 18px;
    background: var(--bs-primary, var(--primary, #0071e3));
    color: white;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nx-search-submit:hover {
    background: var(--bs-primary-hover, color-mix(in srgb, var(--bs-primary, var(--primary, #0071e3)) 85%, black));
    transform: translateY(-50%) scale(1.08); /* Maintain centering while scaling */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.nx-search-submit:active {
    transform: translateY(-50%) scale(0.95); /* Maintain centering while scaling */
    transition-duration: 0.1s;
}

/* Search Results – positioned under input wrapper, z-index above desktop nav */
.nx-search-results,
.nx-search-results.search-list-show,
.nx-search-results.search-list-mbl-show,
.search-list,
.search-list.search-list-show,
.search-list.search-list-mbl-show {
    z-index: 1110 !important;
}

/* Override legacy .search-list top so dropdown sits under input (not 49px/89px) */
.nx-search-input-wrapper .search-list,
.nx-header-search .search-list,
.nx-header-search .nx-search-results.search-list {
    top: 100% !important;
    max-height: 450px;
    height: auto;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
}

.nx-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--nx-header-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    max-height: 450px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: var(--nx-header-transition);
}

.nx-search-results.search-list-show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Ensure search results and mobile search results stay above nav (no change to nav bar) */
.nx-header-content {
    overflow: visible;
}

.nx-search-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Action Buttons */
.nx-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nx-action-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    color: var(--nx-header-text);
    text-decoration: none;
    border-radius: 0.75rem;
    transition: var(--nx-header-hover-transition);
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: var(--nx-header-font);
}

.nx-action-button:hover {
    background: rgba(0, 0, 0, 0.04);
    transform: translateY(-1px);
}

.nx-action-icon {
    position: relative;
    color: var(--nx-header-accent);
}

.nx-cart-icon-wrapper {
    position: relative;
}

.nx-cart-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ff3b30;
    color: white;
    font-size: 11px;
    font-weight: var(--nx-header-font-weight-semibold);
    border-radius: 9px;
    padding: 0 0.25rem;
}

.nx-action-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.nx-action-title {
    font-size: 14px;
    font-weight: var(--nx-header-font-weight-medium);
    color: var(--nx-header-text);
    white-space: nowrap;
}

.nx-action-subtitle {
    font-size: 12px;
    color: var(--nx-header-text-secondary);
    white-space: nowrap;
}

/* Auth Links */
.nx-auth-link {
    color: inherit;
    text-decoration: none;
    font-weight: var(--nx-header-font-weight-medium);
    transition: var(--nx-header-hover-transition);
}

.nx-login-link {
    color: #34c759;
}

.nx-register-link {
    color: #ff3b30;
}

.nx-auth-separator {
    color: var(--nx-header-text-secondary);
    margin: 0 0.25rem;
}

.nx-auth-link:hover {
    opacity: 0.8;
}

/* ========================================================================
   MODERN NAVIGATION STYLES
   ======================================================================== */

.nx-desktop-nav {
    position: relative;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* When search dropdown is open, desktop header stacks above nav so results overlay nav */
.nx-desktop-header:has(.nx-search-results.search-list-show),
.nx-desktop-header:has(.nx-search-results.search-list-mbl-show) {
    position: relative;
    z-index: 1001;
}

.nx-main-navigation {
    display: flex;
    justify-content: center;
    min-height: var(--nx-nav-height);
}

.nx-nav-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.nx-nav-item {
    position: relative;
}

.nx-nav-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.75rem 1rem;
    color: var(--nx-header-text);
    text-decoration: none;
    font-size: 15px;
    font-weight: var(--nx-header-font-weight-regular);
    border-radius: 0.5rem;
    transition: var(--nx-header-hover-transition);
    white-space: nowrap;
}

.nx-nav-item .nx-nav-link span {
    font-weight: 500;
}

.nx-nav-link:hover,
.nx-nav-link.nx-active {
    color: var(--nx-header-accent);
    background: var(--nx-header-accent-light);
}

.nx-dropdown-icon {
    transition: var(--nx-header-hover-transition);
}

.nx-has-submenu:hover .nx-dropdown-icon {
    transform: rotate(180deg);
}

/* Submenu */
.nx-submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: white;
    border: 1px solid var(--nx-header-border);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: var(--nx-header-transition);
    z-index: 1000;
}

.nx-has-submenu:hover .nx-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nx-submenu-content {
    padding: 0.5rem;
}

.nx-submenu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nx-submenu-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--nx-header-text);
    text-decoration: none;
    font-size: 14px;
    border-radius: 0.375rem;
    transition: var(--nx-header-hover-transition);
}

.nx-submenu-link:hover {
    color: var(--nx-header-accent);
    background: var(--nx-header-accent-light);
}

/* ========================================================================
   MOBILE HEADER STYLES
   ======================================================================== */

.nx-mobile-header {
    background: var(--nx-header-bg);
    border-bottom: 1px solid var(--nx-header-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nx-mobile-container {
    padding-inline: 1rem;
}

.nx-mobile-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--nx-mobile-header-height);
    gap: 1rem;
}

/* Mobile Menu Button */
.nx-mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: var(--nx-header-hover-transition);
}

.nx-mobile-menu-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

.nx-hamburger {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nx-hamburger-line {
    width: 20px;
    height: 2px;
    background: var(--nx-header-text);
    border-radius: 1px;
    transition: var(--nx-header-transition);
}

.nx-mobile-menu-btn.nx-active .nx-hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.nx-mobile-menu-btn.nx-active .nx-hamburger-line:nth-child(2) {
    opacity: 0;
}

.nx-mobile-menu-btn.nx-active .nx-hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile Logo */
.nx-mobile-logo {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nx-mobile-logo-link {
    text-decoration: none;
    transition: var(--nx-header-hover-transition);
}

.nx-mobile-logo-link:hover {
    transform: scale(1.02);
}

.nx-mobile-logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

/* Mobile Cart Button */
.nx-mobile-cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--nx-header-text);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: var(--nx-header-hover-transition);
    position: relative;
}

.nx-mobile-cart-btn:hover {
    background: rgba(0, 0, 0, 0.04);
    transform: scale(1.05);
}

.nx-mobile-cart-icon {
    position: relative;
    color: var(--nx-header-accent);
}

.nx-mobile-cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ff3b30;
    color: white;
    font-size: 11px;
    font-weight: var(--nx-header-font-weight-semibold);
    border-radius: 9px;
    padding: 0 0.25rem;
}

/* ========================================================================
   MOBILE SEARCH STYLES
   ======================================================================== */

.nx-mobile-search {
    position: relative;
    z-index: 1001;
    overflow: visible;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--nx-header-border);
    padding: 0.75rem 0;
}

.nx-mobile-search-form {
    position: relative;
}

.nx-mobile-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0; /* Ensure proper text overflow handling */
    overflow: visible;
}

.nx-mobile-search-input {
    width: 100%;
    height: var(--nx-mobile-search-height);
    padding: 0 4rem 0 0; /* Remove left padding, use text-indent instead */
    text-indent: 4.5rem; /* Force text to start after icon */
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.95);
    font-family: var(--nx-header-font);
    font-size: 16px; /* Prevent zoom on iOS */
    font-weight: var(--nx-header-font-weight-regular);
    color: var(--nx-header-text);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    outline: 1px solid rgba(0, 0, 0, 0.1);
    outline-offset: -1px;
    -webkit-appearance: none; /* Remove iOS styling */
    -webkit-tap-highlight-color: transparent;
}

.nx-mobile-search-input::placeholder {
    color: var(--nx-header-text-secondary);
    opacity: 0.6;
    transition: all 0.3s ease;
    text-overflow: ellipsis; /* Handle long placeholder text */
    white-space: nowrap;
    overflow: hidden;
}

/* Focus State - Mobile Optimized with Theme Color */
.nx-mobile-search-input:focus {
    border-color: var(--bs-primary, var(--primary, #0071e3));
    background: white;
    box-shadow: 
        0 0 0 3px color-mix(in srgb, var(--bs-primary, var(--primary, #0071e3)) 15%, transparent),
        0 6px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.nx-mobile-search-input:focus::placeholder {
    opacity: 0.3;
    transform: translateX(6px);
}

/* Hover State - Touch devices */
.nx-mobile-search-input:hover:not(:focus) {
    border-color: rgba(0, 0, 0, 0.15);
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* Active State - Touch feedback */
.nx-mobile-search-input:active {
    transform: translateY(-1px);
    transition-duration: 0.1s;
}

/* Blur State - Return to default */
.nx-mobile-search-input:not(:focus) {
    transition-delay: 0.1s;
}

.nx-mobile-search-icon {
    position: absolute;
    left: 1rem; /* Position icon properly */
    top: 50%;
    transform: translateY(-50%); /* Perfect vertical centering */
    color: var(--nx-header-text-secondary);
    pointer-events: none;
    z-index: 10; /* Higher z-index to stay above input */
    transition: all 0.3s ease;
    flex-shrink: 0; /* Prevent icon from shrinking */
}

/* Mobile search icon changes color when input is focused */
.nx-mobile-search-input:focus + .nx-mobile-search-icon,
.nx-mobile-search-wrapper:focus-within .nx-mobile-search-icon {
    color: var(--bs-primary, var(--primary, #0071e3));
    transform: translateY(-50%) scale(1.15); /* Maintain centering while scaling */
}

.nx-mobile-search-submit {
    position: absolute;
    right: 0.4rem; /* Slightly more space from right edge */
    top: 50%;
    transform: translateY(-50%); /* Perfect vertical centering */
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 18px;
    background: var(--bs-primary, var(--primary, #0071e3));
    color: white;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    -webkit-tap-highlight-color: transparent;
}

.nx-mobile-search-submit:hover {
    background: var(--bs-primary-hover, color-mix(in srgb, var(--bs-primary, var(--primary, #0071e3)) 85%, black));
    transform: translateY(-50%) scale(1.08); /* Maintain centering while scaling */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.nx-mobile-search-submit:active {
    transform: translateY(-50%) scale(0.92); /* Maintain centering while scaling */
    transition-duration: 0.1s;
}

/* Mobile Search Results – z-index above mobile nav & overlays */
.nx-mobile-search-results,
.nx-mobile-search-results.search-list-mbl-show,
.search-list-mbl,
.search-list-mbl.search-list-mbl-show {
    z-index: 1110 !important;
}

/* Override legacy .search-list-mbl (top: 53px) so dropdown sits under input */
.nx-mobile-search-wrapper .nx-mobile-search-results,
.nx-mobile-search-wrapper .search-list-mbl,
.nx-mobile-search-form .nx-mobile-search-results.search-list-mbl,
.nx-mobile-search-form .search-list-mbl {
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: 350px;
    height: auto;
    margin-right: 0;
    box-sizing: border-box;
}

.nx-mobile-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--nx-header-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    max-height: 350px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: var(--nx-header-transition);
}

.nx-mobile-search-results.search-list-mbl-show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nx-mobile-search-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Mobile Search Improvements */
.nx-mobile-search .nx-mobile-container {
    padding-inline: 1rem; /* Consistent padding for mobile search */
}

/* AGGRESSIVE FIX - Placeholder text positioning matches text-indent */
.nx-search-input::placeholder {
    text-indent: inherit; /* Inherit text-indent from input */
    padding-left: 0;
}

.nx-mobile-search-input::placeholder {
    text-indent: inherit; /* Inherit text-indent from input */
    padding-left: 0;
}

/* Desktop search wrapper improvements */
.nx-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0; /* Ensure proper text overflow */
}

/* Ensure icon doesn't interfere with text input */
.nx-search-icon, 
.nx-mobile-search-icon {
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    position: absolute !important;
    z-index: 10 !important; /* Higher z-index to stay above input */
}

/* NUCLEAR OPTION - Force text-indent on all search inputs globally */
input[type="text"]:not([class*="search"]),
input[type="search"],
input[id*="search"],
input[name*="search"],
.nx-search-input,
.nx-mobile-search-input,
#search-product-item,
#search-product-item-mbl {
    text-indent: 1.5rem !important; /* Force text to start after icon */
    padding-left: 0 !important; /* Remove conflicting padding */
}

/* Desktop search specific */
.nx-search-input,
#search-product-item {
    text-indent: 3rem !important;
}

/* Mobile search specific */  
.nx-mobile-search-input,
#search-product-item-mbl {
    text-indent: 3rem !important;
}

/* Ensure proper spacing on smaller screens */
@media (max-width: 480px) {
    .nx-mobile-search-input {
        padding: 0 4.2rem 0 0; /* Remove left padding */
        text-indent: 5rem; /* Much more text indent on small screens */
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .nx-mobile-search-icon {
        left: 1rem; /* Keep icon closer to edge */
    }
    
    .nx-mobile-search-submit {
        right: 0.6rem; /* Adjust button position for smaller screens */
    }
}

/* ========================================================================
   MOBILE NAVIGATION STYLES
   ======================================================================== */

.nx-mobile-nav {
    position: fixed;
    inset: 0;
    z-index: 2000;
    pointer-events: none;
    font-family: var(--nx-header-font);
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.3s ease, opacity 0.3s ease;
}

.nx-mobile-nav.nx-active {
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
}

.nx-mobile-nav-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: var(--nx-header-transition);
}

.nx-mobile-nav.nx-active .nx-mobile-nav-backdrop {
    opacity: 1;
}

.nx-mobile-nav-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--nx-mobile-nav-width);
    height: 100vh;
    height: 100dvh;
    background: rgba(255, 255, 255, 0.98);
    display: flex !important; /* Ensure panel is visible */
    flex-direction: column;
    visibility: visible !important;
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-right: 1px solid var(--nx-header-border);
    transform: translateX(-100%);
    transition: var(--nx-header-transition);
    overflow-y: auto;
    overscroll-behavior: contain;
}

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

/* Mobile Nav Header */
.nx-mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--nx-header-border);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.nx-mobile-nav-logo img {
    height: 28px;
    width: auto;
}

.nx-mobile-nav-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 18px;
    color: var(--nx-header-text);
    cursor: pointer;
    transition: var(--nx-header-hover-transition);
}

.nx-mobile-nav-close:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
}

/* Mobile Nav Content */
.nx-mobile-nav-content {
    padding: 1rem;
    display: block !important; /* Ensure content is visible */
    visibility: visible !important;
    opacity: 1 !important;
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(100vh - 80px); /* Full height minus header */
    -webkit-overflow-scrolling: touch;
}

/* User Section */
.nx-mobile-user-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--nx-header-accent-light) 0%, color-mix(in srgb, var(--nx-header-accent) 4%, transparent) 100%);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.nx-mobile-user-avatar {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 24px;
    color: var(--nx-header-accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nx-mobile-user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.nx-mobile-user-name {
    font-size: 16px;
    font-weight: var(--nx-header-font-weight-semibold);
    color: var(--nx-header-text);
}

.nx-mobile-user-role {
    font-size: 13px;
    color: var(--nx-header-text-secondary);
    text-transform: capitalize;
}

.nx-mobile-user-arrow {
    color: var(--nx-header-text-secondary);
    transition: var(--nx-header-hover-transition);
}

.nx-mobile-user-section:hover .nx-mobile-user-arrow {
    color: var(--nx-header-accent);
    transform: translateX(2px);
}

/* Navigation List */
.nx-mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
    display: block !important; /* Ensure list is visible */
    visibility: visible !important;
    opacity: 1 !important;
}

.nx-mobile-nav-item {
    margin-bottom: 0.25rem;
    display: block !important; /* Ensure items are visible */
    visibility: visible !important;
    opacity: 1 !important;
}

.nx-mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--nx-header-text);
    text-decoration: none;
    font-size: 16px;
    font-weight: var(--nx-header-font-weight-regular);
    border-radius: 8px;
    transition: var(--nx-header-hover-transition);
}

.nx-mobile-nav-link:hover,
.nx-mobile-nav-link.nx-active {
    background: var(--nx-header-accent-light);
    color: var(--nx-header-accent);
}

.nx-mobile-nav-icon {
    color: var(--nx-header-text-secondary);
    transition: var(--nx-header-hover-transition);
}

.nx-mobile-nav-link:hover .nx-mobile-nav-icon,
.nx-mobile-nav-link.nx-active .nx-mobile-nav-icon {
    color: var(--nx-header-accent);
}

.nx-mobile-submenu-arrow {
    margin-left: auto;
    color: var(--nx-header-text-secondary);
    transition: var(--nx-header-transition);
}

.nx-mobile-nav-item.nx-has-submenu.nx-expanded .nx-mobile-submenu-arrow {
    transform: rotate(90deg);
}

/* Submenu */
.nx-mobile-submenu {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, margin-top 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    opacity: 0;
    visibility: hidden;
    display: block !important; /* Always display, just control height */
}

.nx-mobile-nav-item.nx-expanded .nx-mobile-submenu {
    max-height: 500px !important;
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem !important;
    padding: 0.25rem 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    overflow: visible !important;
    display: block !important;
}

/* Ensure submenu items are visible when parent is expanded */
.nx-mobile-nav-item.nx-expanded .nx-mobile-submenu .nx-mobile-submenu-item {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin-bottom: 0.25rem;
}

.nx-mobile-nav-item.nx-expanded .nx-mobile-submenu .nx-mobile-submenu-link {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.nx-mobile-submenu-item {
    margin-left: 3rem;
    display: block;
    visibility: visible;
    opacity: 1;
}

.nx-mobile-submenu-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--nx-header-text-secondary);
    text-decoration: none;
    font-size: 15px;
    border-radius: 6px;
    transition: var(--nx-header-hover-transition);
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.nx-mobile-submenu-link:hover {
    background: var(--nx-header-accent-light);
    color: var(--nx-header-accent);
}

.nx-mobile-submenu-link.nx-active {
    background: var(--nx-header-accent-light);
    color: var(--nx-header-accent);
    font-weight: 600;
}

.nx-mobile-submenu-item.nx-active {
    background: rgba(13, 110, 253, 0.05);
}

/* Active parent category in mobile nav */
.nx-mobile-nav-item.nx-active-parent > .nx-mobile-nav-link {
    color: var(--nx-header-accent);
    font-weight: 500;
}

.nx-mobile-nav-item.nx-active-parent > .nx-mobile-nav-link .nx-mobile-nav-icon {
    color: var(--nx-header-accent);
}

/* Secondary Menu */
.nx-mobile-secondary-menu {
    padding-top: 1.5rem;
    border-top: 1px solid var(--nx-header-border);
    margin-bottom: 2rem;
}

.nx-mobile-section-title {
    font-size: 14px;
    font-weight: var(--nx-header-font-weight-semibold);
    color: var(--nx-header-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

.nx-mobile-secondary-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nx-mobile-secondary-link {
    display: block;
    padding: 0.75rem 0;
    color: var(--nx-header-text-secondary);
    text-decoration: none;
    font-size: 15px;
    transition: var(--nx-header-hover-transition);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.nx-mobile-secondary-link:hover {
    color: var(--nx-header-accent);
    padding-left: 0.5rem;
}

/* Auth Section */
.nx-mobile-auth-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--nx-header-border);
}

.nx-mobile-auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-family: var(--nx-header-font);
    font-size: 16px;
    font-weight: var(--nx-header-font-weight-medium);
    text-decoration: none;
    transition: var(--nx-header-hover-transition);
    cursor: pointer;
}

.nx-mobile-login-btn {
    background: var(--nx-header-accent);
    color: white;
}

.nx-mobile-login-btn:hover {
    background: var(--nx-header-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--nx-header-accent-light);
}

.nx-mobile-register-btn {
    background: var(--nx-header-accent-light);
    color: var(--nx-header-accent);
    border: 1px solid var(--nx-header-accent-light);
}

.nx-mobile-register-btn:hover {
    background: var(--nx-header-accent-light);
    border-color: var(--nx-header-accent);
    opacity: 0.8;
}

/* ========================================================================
   FOCUS STYLES FOR ACCESSIBILITY
   ======================================================================== */

.nx-focus-ring:focus-visible {
    outline: 2px solid var(--nx-header-accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Additional focus styles for topbar elements */
.nx-topbar .nx-focus-ring:focus-visible {
    outline-color: white;
    outline-width: 2px;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.nx-header .nx-focus-ring:focus-visible {
    outline-color: var(--nx-header-accent);
    box-shadow: 0 0 0 3px var(--nx-header-accent-light);
}

/* ========================================================================
   RESPONSIVE DESIGN
   ======================================================================== */

/* Large Desktop */
@media (min-width: 1400px) {
    .nx-container {
        max-width: 1360px;
    }
    
    .nx-header-actions {
        gap: 1.5rem;
    }
    
    .nx-nav-menu {
        gap: 1rem;
    }
}

/* Tablet */
@media (max-width: 1023px) {
    .nx-header-content {
        gap: 1.5rem;
    }
    
    .nx-action-content {
        display: none;
    }
    
    .nx-action-button {
        padding: 0.5rem;
    }
}

/* Small Tablet */
@media (max-width: 768px) {
    .nx-container {
        padding-inline: 1rem;
    }
    
    .nx-topbar-nav {
        gap: 1rem;
    }
    
    .nx-social-links {
        gap: 0.5rem;
    }
    
    .nx-topbar {
        font-size: 12px;
    }
    
    .nx-topbar .nx-social-link {
        width: 28px;
        height: 28px;
    }
}

/* Mobile */
@media (max-width: 640px) {
    :root {
        --nx-mobile-nav-width: min(280px, 80vw);
    }
    
    .nx-topbar-right {
        gap: 1rem;
    }
    
    .nx-mobile-nav-panel {
        width: 100vw;
    }
}

/* ========================================================================
   REDUCED MOTION PREFERENCES
   ======================================================================== */

@media (prefers-reduced-motion: reduce) {
    .nx-topbar,
    .nx-desktop-header,
    .nx-desktop-nav,
    .nx-mobile-header,
    .nx-mobile-search,
    .nx-mobile-nav-panel,
    .nx-mobile-nav-backdrop,
    .nx-submenu,
    .nx-mobile-submenu,
    .nx-search-results,
    .nx-mobile-search-results {
        transition: none;
    }
    
    .nx-hamburger-line,
    .nx-dropdown-icon,
    .nx-mobile-submenu-arrow {
        transition: none;
    }
    
    .nx-action-button:hover,
    .nx-nav-link:hover,
    .nx-mobile-nav-link:hover,
    .nx-logo-link:hover,
    .nx-mobile-logo-link:hover {
        transform: none;
    }
}

/* ========================================================================
   HIGH CONTRAST MODE SUPPORT
   ======================================================================== */

@media (prefers-contrast: high) {
    .nx-topbar,
    .nx-desktop-header,
    .nx-desktop-nav,
    .nx-mobile-header,
    .nx-mobile-search {
        border-bottom-width: 2px;
    }
    
    .nx-search-input,
    .nx-mobile-search-input {
        border-width: 2px;
    }
    
    .nx-submenu,
    .nx-search-results,
    .nx-mobile-search-results {
        border-width: 2px;
    }
}

/* ========================================================================
   PRINT STYLES
   ======================================================================== */

@media print {
    .nx-topbar,
    .nx-mobile-header,
    .nx-mobile-search,
    .nx-mobile-nav {
        display: none !important;
    }
    
    .nx-desktop-header {
        position: static !important;
        background: white !important;
        backdrop-filter: none !important;
        box-shadow: none !important;
    }
    
    .nx-desktop-nav {
        display: none !important;
    }
}