/**
 * MOBILE NAVBAR - Clean & Simple
 */

@media (max-width: 992px) {

  /* === NAVBAR === */
  .main-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px !important;
    max-height: 60px !important;
    background: #1a1a1a;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    z-index: 1000;
    overflow: hidden;
  }

  .navbar-container {
    padding: 0 1rem;
    height: 100%;
  }

  .navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
  }

  /* === LOGO === */
  .brand-logo {
    height: 40px;
    width: auto;
  }

  .navbar-brand {
    display: flex;
    align-items: center;
  }

  /* === SEARCH HIDDEN === */
  .navbar-search {
    display: none;
  }

  /* === ACTION BUTTONS === */
  .navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }

  .navbar-action-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1.1rem;
    position: relative;
  }

  .navbar-action-btn:active {
    background: rgba(255,255,255,0.1);
  }

  .cart-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    background: #e02020;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
  }

  /* === HAMBURGER === */
  .mobile-menu-toggle {
    width: 44px;
    height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1002;
  }

  .mobile-menu-toggle i {
    display: none;
  }

  .mobile-menu-toggle::before,
  .mobile-menu-toggle::after {
    content: '';
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.2s ease;
  }

  .mobile-menu-toggle span {
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: opacity 0.2s ease;
  }

  .mobile-menu-toggle.active {
    gap: 0;
  }

  .mobile-menu-toggle.active::before {
    transform: translateY(2px) rotate(45deg);
  }

  .mobile-menu-toggle.active::after {
    transform: translateY(-2px) rotate(-45deg);
  }

  .mobile-menu-toggle.active span {
    opacity: 0;
  }

  /* === MOBILE MENU === */
  .nav-menu {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #111;
    padding: 1rem;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .nav-menu.mobile-active,
  .nav-menu.active {
    opacity: 1;
    visibility: visible;
  }

  /* === NAV ITEMS === */
  .nav-item {
    width: 100%;
  }

  .nav-link {
    display: block;
    padding: 0.875rem 1rem;
    background: #1a1a1a;
    border-radius: 10px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
  }

  .nav-link:active {
    background: #252525;
  }

  /* Dropdown link - with arrow on right */
  .nav-link.has-dropdown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
  }

  /* Hide desktop dropdown arrow (▼) */
  .nav-link.has-dropdown::before {
    display: none !important;
  }

  .nav-link.has-dropdown::after {
    content: '';
    width: 6px;
    height: 6px;
    border-right: 2px solid rgba(255,255,255,0.5);
    border-bottom: 2px solid rgba(255,255,255,0.5);
    transform: rotate(45deg);
    transition: transform 0.15s ease;
    flex-shrink: 0;
  }

  .nav-item.mobile-dropdown-active .nav-link.has-dropdown::after {
    transform: rotate(-135deg);
  }

  .nav-item.mobile-dropdown-active .nav-link.has-dropdown {
    background: #252525;
    color: #e02020;
  }

  /* === DROPDOWN - OVERRIDE DESKTOP STYLES === */
  .mega-dropdown-modern {
    /* Reset desktop positioning */
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    animation: none !important;
    min-width: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    border-top: none !important;
    border-radius: 10px !important;

    /* Mobile specific */
    display: none;
    margin-top: 0.5rem;
    background: #0d0d0d !important;
    padding: 0.75rem;
    overflow: hidden;
  }

  .nav-item.mobile-dropdown-active .mega-dropdown-modern {
    display: block !important;
  }

  /* Hide header on mobile */
  .mega-header-modern {
    display: none !important;
  }

  /* Hide dividers on mobile */
  .mega-divider {
    display: none !important;
  }

  /* === CATEGORY ITEMS === */
  .mega-category-simple {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.875rem !important;
    background: #1a1a1a !important;
    border-radius: 8px !important;
    border-left: none !important;
    color: #fff !important;
    font-size: 0.875rem !important;
    text-decoration: none;
    margin-bottom: 0.375rem;
  }

  .mega-category-simple:last-child {
    margin-bottom: 0;
  }

  .mega-category-simple:active {
    background: #252525 !important;
  }

  /* Category icon */
  .mega-category-simple > i:first-child {
    color: #e02020 !important;
    font-size: 1rem;
    width: 20px;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
  }

  /* Submenu arrow icon */
  .mega-category-simple i.submenu-arrow {
    margin-left: auto;
    color: rgba(255,255,255,0.4) !important;
    font-size: 0.7rem !important;
    transition: transform 0.15s ease;
    flex-shrink: 0;
    opacity: 1 !important;
    transform: none;
  }

  .mega-category-with-submenu.submenu-active .mega-category-simple {
    background: #252525 !important;
  }

  .mega-category-with-submenu.submenu-active .submenu-arrow {
    transform: rotate(90deg) !important;
    color: #e02020 !important;
  }

  /* === SUBMENU - OVERRIDE DESKTOP === */
  .mega-submenu-right {
    /* Reset desktop positioning */
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    min-width: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    border-left: 2px solid rgba(224, 32, 32, 0.3) !important;
    border-radius: 0 !important;
    z-index: auto !important;
    margin-left: 1.5rem !important;

    /* Mobile specific */
    display: none;
    margin-top: 0.375rem;
    padding: 0 !important;
    padding-left: 0.5rem !important;
    background: transparent !important;
  }

  .mega-category-with-submenu.submenu-active .mega-submenu-right {
    display: block !important;
  }

  /* Make sure hover doesn't affect mobile */
  .mega-category-with-submenu:hover .mega-submenu-right {
    display: none;
  }

  .mega-category-with-submenu.submenu-active:hover .mega-submenu-right {
    display: block !important;
  }

  .submenu-item {
    display: flex !important;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem !important;
    background: #151515 !important;
    border-radius: 6px !important;
    border-left: none !important;
    color: rgba(255,255,255,0.85) !important;
    font-size: 0.8rem !important;
    text-decoration: none;
    margin-bottom: 0.25rem;
  }

  .submenu-item:last-child {
    margin-bottom: 0;
  }

  .submenu-item:active {
    background: #1f1f1f !important;
  }

  .submenu-item i {
    color: #e02020 !important;
    font-size: 0.85rem;
    width: 16px;
    min-width: 16px;
    text-align: center;
    flex-shrink: 0;
  }

  /* === CATEGORY WITH SUBMENU WRAPPER === */
  .mega-category-with-submenu {
    position: static !important;
    margin-bottom: 0.375rem;
  }

  .mega-category-with-submenu:last-of-type {
    margin-bottom: 0;
  }

}

/* ========== SMALL MOBILE ========== */
@media (max-width: 576px) {
  .main-navbar {
    height: 56px !important;
    max-height: 56px !important;
  }

  .navbar-content {
    height: 56px;
  }

  .brand-logo {
    height: 36px;
  }

  .navbar-action-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .mobile-menu-toggle {
    width: 40px;
    height: 40px;
  }

  .nav-menu {
    top: 56px;
    padding: 0.75rem;
  }

  .nav-link {
    padding: 0.75rem 0.875rem;
    font-size: 0.9rem;
  }

  .mega-dropdown-modern {
    padding: 0.5rem;
  }

  .mega-category-simple {
    padding: 0.625rem 0.75rem;
    font-size: 0.8rem;
  }

  .submenu-item {
    padding: 0.5rem 0.625rem;
    font-size: 0.75rem;
  }
}

/* ========== BODY LOCK ========== */
body.mobile-menu-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* ========== LIGHT THEME ========== */
@media (max-width: 992px) {
  html[data-theme="light"] .main-navbar {
    background: #fff;
    border-bottom-color: rgba(0,0,0,0.08);
  }

  html[data-theme="light"] .navbar-action-btn {
    color: #1a1a1a;
  }

  html[data-theme="light"] .mobile-menu-toggle::before,
  html[data-theme="light"] .mobile-menu-toggle::after,
  html[data-theme="light"] .mobile-menu-toggle span {
    background: #1a1a1a;
  }

  html[data-theme="light"] .nav-menu {
    background: #f5f5f5;
  }

  html[data-theme="light"] .nav-link {
    background: #fff;
    color: #1a1a1a;
  }

  html[data-theme="light"] .nav-link:active,
  html[data-theme="light"] .nav-item.mobile-dropdown-active .nav-link.has-dropdown {
    background: #f0f0f0;
  }

  html[data-theme="light"] .nav-link.has-dropdown::after {
    border-color: rgba(0,0,0,0.4);
  }

  html[data-theme="light"] .mega-dropdown-modern {
    background: #eee !important;
  }

  html[data-theme="light"] .mega-category-simple {
    background: #fff !important;
    color: #1a1a1a !important;
  }

  html[data-theme="light"] .mega-category-simple:active,
  html[data-theme="light"] .mega-category-with-submenu.submenu-active .mega-category-simple {
    background: #f5f5f5 !important;
  }

  html[data-theme="light"] .mega-category-simple i.submenu-arrow {
    color: rgba(0,0,0,0.4) !important;
  }

  html[data-theme="light"] .mega-submenu-right {
    border-left-color: rgba(224, 32, 32, 0.4) !important;
  }

  html[data-theme="light"] .submenu-item {
    background: #f8f8f8 !important;
    color: #333 !important;
  }

  html[data-theme="light"] .submenu-item:active {
    background: #f0f0f0 !important;
  }
}

/* ========== MOBILE SEARCH OVERLAY ========== */
@media (max-width: 992px) {
  /* Mobile search button - visible only on mobile */
  .mobile-search-btn {
    display: flex !important;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary, #fff);
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
  }

  .mobile-search-btn:active {
    background: rgba(0, 0, 0, 0.1);
  }

  /* Light mode - dark icon */
  html[data-theme="light"] .mobile-search-btn {
    color: #1C1C1C;
  }

  html[data-theme="light"] .mobile-search-btn:active {
    background: rgba(0, 0, 0, 0.08);
  }

  /* Dark mode - light icon */
  html[data-theme="dark"] .mobile-search-btn {
    color: #ffffff;
  }

  html[data-theme="dark"] .mobile-search-btn:active {
    background: rgba(255, 255, 255, 0.1);
  }

  /* Search Overlay */
  .mobile-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    display: flex;
    flex-direction: column;
    padding: 1rem;
  }

  .mobile-search-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  /* Search Header */
  .mobile-search-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .mobile-search-close {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    flex-shrink: 0;
  }

  .mobile-search-close:active {
    background: rgba(255,255,255,0.2);
  }

  /* Search Input Container */
  .mobile-search-input-container {
    flex: 1;
    position: relative;
  }

  .mobile-search-input {
    width: 100%;
    height: 48px;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 0 1rem 0 2.75rem;
    font-size: 1rem;
    color: #fff;
    outline: none;
  }

  .mobile-search-input::placeholder {
    color: rgba(255,255,255,0.5);
  }

  .mobile-search-input:focus {
    border-color: var(--accent-color, #e02020);
    background: rgba(255,255,255,0.15);
  }

  .mobile-search-input-container i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.5);
    font-size: 1rem;
  }

  /* Search Results */
  .mobile-search-results {
    flex: 1;
    overflow-y: auto;
    margin-top: 0.5rem;
  }

  .mobile-search-results .search-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    text-decoration: none;
    transition: background 0.15s ease;
  }

  .mobile-search-results .search-item:active {
    background: rgba(255,255,255,0.1);
  }

  .mobile-search-results .search-item-image {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255,255,255,0.1);
  }

  .mobile-search-results .search-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .mobile-search-results .search-item-info {
    flex: 1;
    min-width: 0;
  }

  .mobile-search-results .search-item-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-search-results .search-item-price {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-color, #e02020);
  }

  .mobile-search-results .search-no-results {
    text-align: center;
    padding: 2rem 1rem;
    color: rgba(255,255,255,0.6);
  }

  .mobile-search-results .search-no-results i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
  }

  /* Light theme */
  html[data-theme="light"] .mobile-search-overlay {
    background: rgba(255, 255, 255, 0.98);
  }

  html[data-theme="light"] .mobile-search-close {
    background: rgba(0,0,0,0.05);
    color: #333;
  }

  html[data-theme="light"] .mobile-search-input {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.1);
    color: #333;
  }

  html[data-theme="light"] .mobile-search-input::placeholder {
    color: rgba(0,0,0,0.4);
  }

  html[data-theme="light"] .mobile-search-input-container i {
    color: rgba(0,0,0,0.4);
  }

  html[data-theme="light"] .mobile-search-results .search-item {
    background: rgba(0,0,0,0.03);
  }

  html[data-theme="light"] .mobile-search-results .search-item:active {
    background: rgba(0,0,0,0.06);
  }

  html[data-theme="light"] .mobile-search-results .search-item-title {
    color: #333;
  }

  html[data-theme="light"] .mobile-search-results .search-no-results {
    color: rgba(0,0,0,0.5);
  }
}

/* Hide mobile search button on desktop */
@media (min-width: 993px) {
  .mobile-search-btn {
    display: none !important;
  }

  .mobile-search-overlay {
    display: none !important;
  }
}
