/**
 * Afoomart Global Header, Search & Navigation System (Chapter 04)
 * Architecture:
 * - Layer 1: Top Utility Bar (White background, subtle border, small clean typography)
 * - Layer 2: Main Storefront Header (Official logo, dominant search bar, account, wishlist, cart)
 * - Layer 3: Primary Navigation Strip & Mega Menu Foundation
 * - Dedicated Mobile Header (< 768px viewports)
 * - Fullscreen Mobile Search Overlay
 * - Mobile Offcanvas Navigation Drawer
 * - Sticky Header Behavior & Smooth Transitions
 */

/* ==================================================
   1. Master Sticky Header Container & Layering
   ================================================== */
.site-header {
  position: relative;
  width: 100%;
  background-color: var(--color-surface);
  z-index: var(--z-sticky);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.site-header.is-sticky {
  position: sticky;
  top: 0;
  box-shadow: var(--shadow-md);
}

.admin-bar .site-header.is-sticky {
  top: 32px;
}

@media (max-width: 782px) {
  .admin-bar .site-header.is-sticky {
    top: 46px;
  }
}

/* When scrolled, utility bar collapses smoothly and header becomes compact */
.site-header.is-scrolled .af-topbar {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  border-bottom: none;
  padding: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

.site-header.is-scrolled .af-header-inner {
  height: 64px;
}

.site-header.is-scrolled .af-logo-img {
  max-height: 34px;
}

/* Spacer element to eliminate layout shifts when header sticks */
.af-header-spacer {
  display: none;
}

/* ==================================================
   2. LAYER 1: Top Utility Bar
   Requirements:
   - White background
   - Dark text
   - Very subtle border
   - Small but readable typography (12px-13px)
   ================================================== */
.af-topbar {
  background-color: var(--color-surface, #ffffff);
  color: var(--color-text-secondary, #4b5563);
  border-bottom: 1px solid var(--color-border-light, #e5e7eb);
  font-size: var(--font-size-caption, 12px);
  height: 38px;
  line-height: 38px;
  transition: all var(--transition-fast);
  overflow: hidden;
}

.af-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  gap: var(--space-4, 16px);
  white-space: nowrap;
}

.af-topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3, 12px);
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
}

.af-topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3, 12px);
  flex-shrink: 0;
  margin-left: auto;
}

.af-topbar-divider {
  color: var(--color-border, #d1d5db);
  font-size: 11px;
  user-select: none;
  opacity: 0.7;
}

.af-topbar-sell-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1, 4px);
  color: var(--color-primary, #113F6D);
  text-decoration: none;
  font-weight: var(--font-weight-semibold, 600);
  transition: color var(--transition-fast);
  flex-shrink: 0;
}

.af-topbar-sell-link:hover {
  color: var(--color-accent, #DE2C27);
}

.af-topbar-announcement {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2, 8px);
  color: var(--color-text-secondary, #4b5563);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.af-topbar-announcement-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.af-topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-text-secondary);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  transition: color var(--transition-fast);
}

.af-topbar-link:hover {
  color: var(--color-primary);
}

.af-topbar-auth {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.af-topbar-auth-slash {
  color: var(--color-text-muted);
}

/* Currency / Language Topbar Dropdown */
.af-topbar-dropdown {
  position: relative;
  display: inline-block;
}

.af-topbar-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 170px;
  padding: 4px 0;
  z-index: var(--z-dropdown);
  display: none;
}

.af-topbar-dropdown.is-open .af-topbar-dropdown-menu {
  display: block;
}

.af-topbar-dropdown-item {
  display: block;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
}

.af-topbar-dropdown-item:hover:not(.disabled) {
  background-color: var(--color-surface-muted);
  color: var(--color-primary);
}

.af-topbar-dropdown-item.active {
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  background-color: var(--color-primary-tint);
}

.af-topbar-dropdown-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==================================================
   3. LAYER 2: Main Storefront Header
   ================================================== */
.af-main-header {
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border-light);
  position: relative;
  z-index: 20;
}

.af-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
  gap: var(--space-6, 24px);
  transition: height var(--transition-fast);
}

/* 3.1 Brand Logo */
.af-brand-logo {
  order: 1 !important;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-right: var(--space-2, 8px);
}

.af-brand-logo-link {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
}

.af-logo-img {
  max-height: 44px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  transition: max-height var(--transition-fast);
  display: block;
}

/* 3.2 Dominant Search Bar Area */
.af-header-search-wrap {
  order: 2 !important;
  flex: 1;
  max-width: 740px;
  margin: 0 var(--space-4, 16px);
  min-width: 0;
}

/* 3.3 Customer Actions: Account, Wishlist, Cart */
.af-header-actions {
  order: 3 !important;
  display: flex;
  align-items: center;
  gap: var(--space-4, 16px);
  flex-shrink: 0;
  margin-left: auto;
}

.af-header-search-component {
  position: relative;
  width: 100%;
}

.af-search-box {
  display: flex;
  align-items: stretch;
  background-color: var(--color-surface);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-sm);
  height: 44px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  overflow: visible;
}

.af-search-box:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(222, 44, 39, 0.15);
}

/* Category Picker inside Search */
.af-search-cat-picker-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background-color: var(--color-surface-muted);
  border-right: 1px solid var(--color-border);
  flex-shrink: 0;
}

.af-search-cat-picker {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  padding: 0 28px 0 14px;
  font-size: var(--font-size-body-small);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  cursor: pointer;
  height: 100%;
  outline: none;
  max-width: 155px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.af-search-cat-arrow {
  position: absolute;
  right: 10px;
  pointer-events: none;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
}

/* Search Input Field Wrap */
.af-search-field-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.af-search-input-field {
  width: 100%;
  height: 100%;
  border: none;
  padding: 0 38px 0 16px;
  font-family: inherit;
  font-size: var(--font-size-body);
  color: var(--color-text);
  background: transparent;
  outline: none;
}

.af-search-input-field::placeholder {
  color: var(--color-text-muted);
}

/* Clear Button */
.af-search-clear-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  display: none;
  line-height: 1;
}

.af-search-clear-btn.is-visible {
  display: block;
}

.af-search-clear-btn:hover {
  color: var(--color-accent);
}

/* Search Submit Button */
.af-search-submit-btn {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  border: none;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  cursor: pointer;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-body-small);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: background-color var(--transition-fast);
}

.af-search-submit-btn:hover {
  background-color: var(--color-accent);
}

/* ==================================================
   4. Search Autocomplete & Suggestions Dropdown
   ================================================== */
.af-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  display: none;
  overflow: hidden;
  max-height: 520px;
  overflow-y: auto;
}

.af-header-search-component.is-open .af-search-dropdown,
.af-search-dropdown:not([hidden]) {
  display: block;
}

.af-search-section {
  border-bottom: 1px solid var(--color-border-light);
}

.af-search-section:last-child {
  border-bottom: none;
}

.af-search-section-header {
  padding: 8px 16px;
  background-color: var(--color-surface-muted);
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.af-search-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 12px 16px;
}

.af-search-pill {
  font-size: var(--font-size-caption);
  background-color: var(--color-surface-muted);
  color: var(--color-text);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.af-search-pill:hover,
.af-search-pill:focus {
  background-color: var(--color-primary-tint);
  border-color: var(--color-primary);
  color: var(--color-primary);
  outline: none;
}

.af-search-suggestion-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 16px;
  text-decoration: none;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border-light);
  transition: background-color var(--transition-fast);
}

.af-search-suggestion-item:last-child {
  border-bottom: none;
}

.af-search-suggestion-item:hover,
.af-search-suggestion-item:focus,
.af-search-suggestion-item.is-selected {
  background-color: var(--color-primary-tint);
  color: var(--color-primary);
  outline: none;
}

.af-search-item-icon {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.af-search-suggestion-thumb-fallback {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background-color: var(--color-surface-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  flex-shrink: 0;
}

.af-search-dropdown-footer {
  padding: 8px 16px;
  background-color: var(--color-surface-muted);
  border-top: 1px solid var(--color-border-light);
}

.af-search-view-all-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-caption);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0;
}

.af-search-view-all-btn:hover {
  color: var(--color-accent);
}

/* ==================================================
   5. Customer Header Actions (Account, Wishlist, Cart)
   ================================================== */
.af-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.af-header-action-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.af-header-action-btn:hover,
.af-header-action-btn:focus-visible {
  background-color: var(--color-surface-muted);
  color: var(--color-primary);
  outline: none;
}

.af-header-action-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.af-header-action-text-wrap {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.2;
}

.af-header-action-caption {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.af-header-action-title {
  font-size: var(--font-size-body-small);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Notification Badges on Icons */
.af-cart-count-badge,
.af-wishlist-count-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background-color: var(--color-accent);
  color: var(--color-text-inverse);
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  border-radius: 9px;
  text-align: center;
  padding: 0 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ==================================================
   6. Account Dropdown Flyout
   ================================================== */
.af-header-account-wrap {
  position: relative;
}

.af-account-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  display: none;
  overflow: hidden;
}

.af-header-account-wrap.is-open .af-account-dropdown-menu,
.af-account-dropdown-menu:not([hidden]) {
  display: block;
}

.af-account-menu-header {
  padding: var(--space-4);
  background-color: var(--color-surface-muted);
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.af-account-menu-header.af-account-logged-out {
  display: block;
  text-align: left;
}

.af-account-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
  font-size: 16px;
  flex-shrink: 0;
}

.af-account-menu-links {
  padding: var(--space-2) 0;
}

.af-account-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 18px;
  color: var(--color-text);
  font-size: var(--font-size-body-small);
  text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.af-account-menu-item:hover,
.af-account-menu-item:focus {
  background-color: var(--color-surface-muted);
  color: var(--color-primary);
  outline: none;
}

.af-account-menu-divider {
  height: 1px;
  background-color: var(--color-border-light);
  margin: 4px 0;
}

.af-account-menu-footer {
  padding: var(--space-1) 0;
}

/* ==================================================
   7. Mini-Cart Dropdown Flyout
   ================================================== */
.af-header-cart-wrap {
  position: relative;
}

.af-mini-cart-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  display: none;
  overflow: hidden;
}

.af-header-cart-wrap.is-open .af-mini-cart-dropdown,
.af-mini-cart-dropdown:not([hidden]) {
  display: block;
}

.af-mini-cart-header {
  padding: 12px 16px;
  background-color: var(--color-surface-muted);
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.af-mini-cart-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
}

.af-mini-cart-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-light);
}

.af-mini-cart-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--color-surface-muted);
  flex-shrink: 0;
}

.af-mini-cart-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.af-mini-cart-details {
  flex: 1;
}

.af-mini-cart-item-title {
  color: var(--color-text);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 2px;
}

.af-mini-cart-item-title:hover {
  color: var(--color-accent);
}

.af-mini-cart-footer {
  padding: 16px;
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

/* ==================================================
   8. LAYER 3: Categories & Primary Navigation Strip
   ================================================== */
.af-nav-strip {
  background-color: var(--color-primary-dark, #0b2545) !important;
  color: #ffffff !important;
  position: relative;
  z-index: 15;
  border-bottom: 2px solid var(--color-accent, #DE2C27);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.af-nav-strip-inner {
  display: flex;
  align-items: center;
  height: 46px;
  gap: var(--space-6, 24px);
}

/* 8.1 Prominent Categories Button */
.af-categories-btn-wrap {
  position: relative;
  flex-shrink: 0;
}

.af-all-categories-btn {
  background-color: var(--color-accent, #DE2C27) !important;
  color: #ffffff !important;
  border: none;
  height: 46px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2, 8px);
  font-weight: var(--font-weight-bold, 700);
  font-size: var(--font-size-body-small, 13px);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.af-all-categories-btn:hover,
.af-all-categories-btn[aria-expanded="true"] {
  background-color: var(--color-accent-dark, #b91c1c) !important;
}

.af-categories-btn-caret {
  margin-left: 4px;
  transition: transform var(--transition-fast);
}

.af-all-categories-btn[aria-expanded="true"] .af-categories-btn-caret {
  transform: rotate(180deg);
}

/* 8.2 Primary Navigation Menu */
.af-primary-nav {
  flex: 1;
}

.af-main-menu {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--space-5, 20px);
}

.af-main-menu li a {
  color: rgba(255, 255, 255, 0.92) !important;
  text-decoration: none;
  font-size: var(--font-size-body-small, 13px);
  font-weight: var(--font-weight-medium, 500);
  padding: 8px 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  transition: color var(--transition-fast);
}

.af-main-menu li a:hover,
.af-main-menu li.current-menu-item a {
  color: #ffffff !important;
  font-weight: var(--font-weight-semibold, 600);
}

.af-main-menu li.current-menu-item a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--color-accent);
}

.af-menu-flash-badge {
  background-color: var(--color-accent);
  color: var(--color-text-inverse);
  font-size: 9px;
  font-weight: var(--font-weight-extrabold);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  margin-right: 4px;
  text-transform: uppercase;
}

.af-nav-phone-link {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.af-nav-phone-link:hover {
  color: var(--color-text-inverse);
}

/* ==================================================
   9. Category Mega Menu Foundation
   ================================================== */
.af-mega-menu-wrapper {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--color-surface);
  box-shadow: var(--shadow-xl);
  border-top: 1px solid var(--color-border);
  border-bottom: 2px solid var(--color-primary);
  z-index: var(--z-dropdown);
  display: none;
}

.af-mega-menu-wrapper:not([hidden]) {
  display: block;
}

.af-mega-menu-container {
  display: flex;
  min-height: 420px;
}

/* Sidebar Rail */
.af-mega-menu-sidebar {
  width: 250px;
  background-color: var(--color-surface-muted);
  border-right: 1px solid var(--color-border);
  padding: var(--space-2) 0;
  flex-shrink: 0;
}

.af-mega-menu-cat-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--color-text);
  font-size: var(--font-size-body-small);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.af-mega-menu-cat-btn:hover,
.af-mega-menu-cat-btn.is-active {
  background-color: var(--color-surface);
  color: var(--color-primary);
  font-weight: var(--font-weight-bold);
  border-left: 3px solid var(--color-accent);
}

.af-mega-cat-icon {
  margin-right: var(--space-2);
  display: flex;
  align-items: center;
  color: var(--color-text-secondary);
}

.af-mega-menu-cat-btn:hover .af-mega-cat-icon,
.af-mega-menu-cat-btn.is-active .af-mega-cat-icon {
  color: var(--color-accent);
}

.af-mega-cat-name {
  flex: 1;
}

/* Dynamic Panels */
.af-mega-menu-panels {
  flex: 1;
  padding: var(--space-6);
  background-color: var(--color-surface);
}

.af-mega-menu-panel {
  display: none;
}

.af-mega-menu-panel.is-active,
.af-mega-menu-panel:not([hidden]) {
  display: flex;
  gap: var(--space-6);
}

.af-mega-subcats-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.af-mega-subcat-title {
  color: var(--color-primary-dark);
  border-bottom: 1px solid var(--color-border-light);
  padding-bottom: 4px;
}

.af-mega-subcat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.af-mega-subcat-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.af-mega-subcat-link:hover {
  color: var(--color-accent);
}

/* Promo Card inside Mega Menu */
.af-mega-promo-card {
  width: 240px;
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  color: var(--color-text-inverse);
  padding: var(--space-5);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-shrink: 0;
}

.af-mega-promo-title {
  color: var(--color-text-inverse);
}

.af-mega-promo-desc {
  color: rgba(255, 255, 255, 0.8);
}

/* ==================================================
   10. Dedicated Mobile Header (< 768px Viewports)
   ================================================== */
.af-mobile-header {
  display: none; /* Shown on mobile via media query */
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 8px 0;
}

.af-mobile-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: 8px;
}

.af-mobile-header-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  cursor: pointer;
  position: relative;
  padding: 0;
}

.af-mobile-logo-img {
  max-height: 32px;
  width: auto;
}

.af-mobile-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.af-mobile-badge {
  position: absolute;
  top: 0;
  right: 0;
  background-color: var(--color-accent);
  color: var(--color-text-inverse);
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  border-radius: 8px;
  text-align: center;
  padding: 0 3px;
}

.af-mobile-search-trigger {
  width: 100%;
  height: 38px;
  background-color: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: var(--space-2);
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}

.af-mobile-search-icon {
  color: var(--color-primary);
  flex-shrink: 0;
}

/* ==================================================
   11. Fullscreen Mobile Search Overlay
   ================================================== */
.af-mobile-search-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--color-surface);
  z-index: var(--z-modal);
  display: none;
  flex-direction: column;
}

.af-mobile-search-overlay:not([hidden]) {
  display: flex;
}

.af-mobile-search-bar {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-2);
  background-color: var(--color-surface);
}

.af-mobile-search-back-btn {
  background: none;
  border: none;
  color: var(--color-text);
  padding: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.af-mobile-search-form {
  flex: 1;
  display: flex;
  align-items: center;
  background-color: var(--color-surface-muted);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 40px;
}

.af-mobile-search-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  height: 100%;
}

.af-mobile-search-input {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  padding: 0 32px 0 12px;
  font-size: 14px;
  color: var(--color-text);
  outline: none;
}

.af-mobile-search-clear {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
}

.af-mobile-search-submit {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  border: none;
  width: 40px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.af-mobile-search-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

.af-mobile-search-block {
  margin-bottom: var(--space-5);
}

.af-mobile-search-block-title {
  font-size: 12px;
  font-weight: var(--font-weight-bold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}

.af-mobile-search-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.af-search-tag {
  background-color: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--color-text);
  text-decoration: none;
}

.af-mobile-search-cats-list {
  display: flex;
  flex-direction: column;
}

.af-mobile-search-cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text);
  text-decoration: none;
  font-size: 14px;
}

/* ==================================================
   12. Mobile Offcanvas Navigation Drawer
   ================================================== */
.af-mobile-nav-drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
}

.af-mobile-nav-drawer:not([hidden]) {
  display: block;
}

.af-mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(10, 25, 47, 0.6);
  backdrop-filter: blur(2px);
  z-index: 1;
}

.af-mobile-drawer-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 85%;
  max-width: 320px;
  background-color: var(--color-surface);
  z-index: 2;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--transition-base) cubic-bezier(0.16, 1, 0.3, 1);
}

.af-mobile-nav-drawer.is-active .af-mobile-drawer-panel {
  transform: translateX(0);
}

.af-mobile-drawer-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.af-mobile-drawer-close-btn {
  background: none;
  border: none;
  color: var(--color-text);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.af-mobile-drawer-user {
  padding: var(--space-4);
  background-color: var(--color-surface-muted);
  border-bottom: 1px solid var(--color-border);
}

.af-drawer-user-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.af-drawer-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  font-weight: var(--font-weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
}

.af-mobile-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

.af-drawer-section {
  margin-bottom: var(--space-5);
}

.af-drawer-section-title {
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}

.af-drawer-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.af-drawer-nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 4px;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text);
  text-decoration: none;
  font-size: 14px;
}

.af-drawer-nav-icon {
  color: var(--color-primary);
  flex-shrink: 0;
}

.af-drawer-nav-text {
  flex: 1;
}

.af-drawer-nav-arrow {
  color: var(--color-text-muted);
}

.af-drawer-seller-box {
  background-color: var(--color-primary-tint);
  border: 1px dashed var(--color-primary);
  border-radius: var(--radius-sm);
}

/* ==================================================
   13. Responsive Breakpoints Engine for Header
   ================================================== */
@media (max-width: 1024px) {
  .af-header-inner {
    gap: var(--space-3);
  }

  .af-main-menu {
    gap: var(--space-3);
  }

  .af-hide-tablet {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .af-topbar,
  .af-main-header,
  .af-nav-strip {
    display: none !important;
  }

  .af-mobile-header {
    display: block !important;
  }
}
