/* ===========================
   CSS Variables
   =========================== */
:root {
  --primary-color: #FF6B35;
  --primary-hover: #e55a2b;
  --danger-color: #dc2626;
  --text-dark: #1f2937;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --background-light: #f9fafb;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --navbar-height: 70px;
  --topbar-height: 40px;
}

/* ===========================
   Top Info Bar
   =========================== */
.top-info-bar {
  background: var(--background-light);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.info-items {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: nowrap;
}

.info-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.info-item span {
  white-space: nowrap;
}

.info-item:hover {
  color: var(--primary-color);
}

.info-item i {
  font-size: 14px;
  color: var(--primary-color);
}

/* Приховати email на менших екранах */
@media (max-width: 1400px) {
  .info-item-email {
    display: none;
  }
}

.chat-link-top {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dark);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  padding: 4px 12px;
  border-radius: 6px;
}

.chat-link-top:hover {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary-color);
}

.chat-icon {
  width: 20px;
  height: 20px;
}

/* ===========================
   Main Navbar
   =========================== */
.main-navbar {
  background: var(--white);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: var(--transition);
}

.main-navbar.scrolled {
  box-shadow: var(--shadow-md);
}

.main-navbar.hidden {
  transform: translateY(-100%);
}

.navbar-content {
  display: flex !important;
  align-items: center;
  gap: 24px;
  padding: 12px 0;
}

/* Fallback для gap */
.navbar-content > * {
  margin-right: 24px;
}

.navbar-content > *:last-child {
  margin-right: 0;
}

.navbar-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.navbar-brand .logo {
  height: 45px;
  width: auto;
  transition: var(--transition);
}

.navbar-brand:hover .logo {
  transform: scale(1.05);
}

/* ===========================
   Search Bar
   =========================== */
.search-container {
  flex: 1;
  max-width: 600px;
  position: relative;
}

.search-form {
  position: relative;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--background-light);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 4px 4px 4px 16px;
  transition: var(--transition);
}

.search-input-wrapper:focus-within {
  background: var(--white);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-icon {
  color: var(--text-muted);
  margin-right: 12px;
  font-size: 16px;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  padding: 10px 8px;
  font-size: 14px;
  color: var(--text-dark);
}

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

.search-btn {
  background: var(--primary-color);
  color: var(--white);
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.search-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1001;
  display: none;
}

.search-dropdown:not(:empty) {
  display: block;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
  cursor: pointer;
}

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

.search-item:hover {
  background: var(--background-light);
}

.search-item img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
}

/* ===========================
   Navbar Actions
   =========================== */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-dark);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.nav-link:hover {
  background: var(--background-light);
  color: var(--primary-color);
}

.nav-link i {
  font-size: 18px;
}

.nav-text {
  font-size: 14px;
}

.dropdown-arrow {
  font-size: 12px;
  transition: var(--transition);
}

.account-dropdown:hover .dropdown-arrow,
.account-dropdown.active .dropdown-arrow {
  transform: rotate(180deg);
}

/* Dropdown Menu */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition);
  z-index: 1001;
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-dark);
  text-decoration: none;
  transition: var(--transition);
  font-size: 14px;
}

.dropdown-item:hover {
  background: var(--background-light);
  color: var(--primary-color);
}

.dropdown-item.text-danger {
  color: var(--danger-color);
}

.dropdown-item.text-danger:hover {
  background: rgba(220, 38, 38, 0.1);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 8px 0;
}

/* Cart Link */
.cart-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  color: var(--text-dark);
  text-decoration: none;
  transition: var(--transition);
}

.cart-link:hover {
  background: var(--background-light);
  color: var(--primary-color);
}

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

.cart-icon-wrapper i {
  font-size: 22px;
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--danger-color);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  line-height: 1.2;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  padding: 8px;
}

.mobile-menu-toggle:hover {
  background: var(--background-light);
}

.burger-line {
  width: 24px;
  height: 2px;
  background: var(--text-dark);
  border-radius: 2px;
  transition: var(--transition);
}

/* ===========================
   Categories Bar
   =========================== */
.categories-navbar {
  background: var(--white);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.categories-navbar .container {
  display: flex;
  justify-content: center;
}

.categories-list {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.category-item {
  position: relative;
}

.category-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: var(--text-dark);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  transition: var(--transition);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.category-link:hover {
  background: var(--background-light);
  color: var(--primary-color);
}

.category-link i {
  font-size: 16px;
}

/* Приховування категорій на менших екранах справа наліво */
@media (max-width: 1400px) {
  .category-item:nth-last-child(1) {
    display: none;
  }
}

@media (max-width: 1300px) {
  .category-item:nth-last-child(1),
  .category-item:nth-last-child(2) {
    display: none;
  }
}

@media (max-width: 1200px) {
  .category-item:nth-last-child(1),
  .category-item:nth-last-child(2),
  .category-item:nth-last-child(3) {
    display: none;
  }
}

@media (max-width: 1100px) {
  .category-item:nth-last-child(1),
  .category-item:nth-last-child(2),
  .category-item:nth-last-child(3),
  .category-item:nth-last-child(4) {
    display: none;
  }
}

@media (max-width: 1000px) {
  .category-item:nth-last-child(1),
  .category-item:nth-last-child(2),
  .category-item:nth-last-child(3),
  .category-item:nth-last-child(4),
  .category-item:nth-last-child(5) {
    display: none;
  }
}

/* Categories Mega Menu */
.categories-mega-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 20px;
  min-width: 850px;
  max-width: 95vw;
  max-height: 80vh;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition);
  z-index: 1001;
}

.categories-mega-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mega-menu-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
}

.mega-menu-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mega-menu-section .section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #FF6B35 0%, #FF9A3C 100%);
  color: var(--white);
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
}

.mega-menu-section .section-header i {
  font-size: 18px;
}

.section-categories {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mega-category-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--background-light);
  color: var(--text-dark);
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid transparent;
}

.mega-category-item:hover {
  background: linear-gradient(135deg, #FF6B35 0%, #FF9A3C 100%);
  color: var(--white);
  transform: translateX(4px);
  border-color: #FF6B35;
}

.category-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.category-thumb-placeholder {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border-radius: 6px;
  flex-shrink: 0;
}

.category-thumb-placeholder i {
  color: #9ca3af;
  font-size: 18px;
}

.mega-category-item:hover .category-thumb-placeholder i {
  color: var(--white);
}

.category-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.category-name {
  font-weight: 500;
  font-size: 14px;
}

.category-count {
  font-size: 12px;
  opacity: 0.75;
}

.mega-category-item:hover .category-count {
  opacity: 0.9;
}

@media (max-width: 1200px) {
  .categories-mega-menu {
    min-width: 700px;
  }

  .mega-menu-sections {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}

@media (max-width: 768px) {
  .categories-mega-menu {
    min-width: 95vw;
  }

  .mega-menu-sections {
    grid-template-columns: 1fr;
  }
}

/* ===========================
   Mobile Navigation
   =========================== */
.mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  pointer-events: none;
}

.mobile-nav.active {
  pointer-events: all;
}

.mobile-nav-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-nav.active .mobile-nav-overlay {
  opacity: 1;
}

.mobile-nav-sidebar {
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 85vw;
  height: 100%;
  background: var(--white);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

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

.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--background-light);
}

.mobile-logo {
  height: 35px;
}

.mobile-nav-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-dark);
  cursor: pointer;
  transition: var(--transition);
}

.mobile-nav-close:hover {
  background: var(--danger-color);
  color: var(--white);
  border-color: var(--danger-color);
}

/* Mobile Search */
.mobile-search {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.mobile-search-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--background-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
}

.mobile-search-wrapper i {
  color: var(--text-muted);
  font-size: 16px;
}

.mobile-search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--text-dark);
}

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

/* Mobile Menu */
.mobile-menu {
  padding: 8px 0;
}

.mobile-menu-section {
  margin-bottom: 8px;
}

.mobile-menu-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.mobile-menu-title i {
  font-size: 14px;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-dark);
  text-decoration: none;
  transition: var(--transition);
  font-size: 14px;
  border-left: 3px solid transparent;
}

.mobile-menu-item:hover {
  background: var(--background-light);
  border-left-color: var(--primary-color);
  color: var(--primary-color);
}

.mobile-menu-item.text-danger {
  color: var(--danger-color);
}

.mobile-menu-item.text-danger:hover {
  background: rgba(220, 38, 38, 0.1);
  border-left-color: var(--danger-color);
}

.mobile-menu-item i {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.item-badge {
  margin-left: auto;
  background: var(--background-light);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
}

/* Navbar Spacer */
.navbar-spacer {
  height: 0;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 991px) {
  .navbar-spacer {
    height: 0;
  }

  .main-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
  }

  .navbar-content {
    padding: 10px 0;
  }

  .navbar-brand {
    margin-right: auto;
  }

  .navbar-brand .logo {
    height: 40px;
  }

  .cart-link {
    padding: 8px;
  }

  body {
    padding-top: 24px !important;
  }
}

@media (max-width: 575px) {
  .navbar-brand .logo {
    height: 35px;
  }

  .cart-badge {
    font-size: 10px;
    padding: 1px 5px;
  }

  .mobile-nav-sidebar {
    width: 100%;
    max-width: 100%;
  }

  body {
    padding-top: 24px !important;
  }
}

/* ===========================
   Live Search Compatibility
   =========================== */
#live-search-results,
#live-search-results-mobile {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1001;
  margin-top: 8px;
}

/* ===========================
   Time2Play Dark Theme Override
   =========================== */

/* Top info bar — світла смужка */
.top-info-bar {
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  color: #6b7280;
}

.info-item {
  color: #6b7280;
}

.info-item:hover {
  color: #FF6B35;
}

.info-item i {
  color: #FF6B35;
}

.chat-link-top {
  color: #374151;
  background: rgba(255,107,53,0.08);
  border-radius: 20px;
  padding: 4px 14px;
}

.chat-link-top:hover {
  background: rgba(255,107,53,0.15);
  color: #FF6B35;
}

/* Main navbar — білий */
.main-navbar {
  background: #ffffff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  border-bottom: 1px solid #f0f0f0;
}

.main-navbar.scrolled {
  background: #ffffff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

/* Search bar */
.search-input-wrapper {
  background: #f4f6f8;
  border-color: #e5e7eb;
}

.search-input-wrapper:focus-within {
  background: #fff;
  border-color: #FF6B35;
  box-shadow: 0 0 0 3px rgba(255,107,53,0.15);
}

.search-icon {
  color: #9ca3af;
}

.search-input {
  color: #1f2937;
}

.search-input::placeholder {
  color: #9ca3af;
}

.search-btn {
  background: linear-gradient(135deg, #FF6B35, #FF9A3C);
  border-radius: 10px;
  font-weight: 600;
}

.search-btn:hover {
  background: linear-gradient(135deg, #e55a2b, #e8893a);
  transform: none;
}

/* Nav links */
.nav-link {
  color: #374151;
}

.nav-link:hover {
  background: #fff3ee;
  color: #FF6B35;
}

.cart-link {
  color: #374151;
}

.cart-link:hover {
  background: #fff3ee;
  color: #FF6B35;
}

.cart-icon-wrapper i {
  color: #374151;
}

.cart-link:hover .cart-icon-wrapper i {
  color: #FF6B35;
}

/* Burger */
.burger-line {
  background: #374151;
}

.mobile-menu-toggle:hover {
  background: #f4f6f8;
}

/* Categories bar */
.categories-navbar {
  background: #ffffff;
  border-top: 1px solid #f0f0f0;
  border-bottom: 1px solid #f0f0f0;
}

.category-link {
  color: #374151;
}

.category-link:hover {
  background: #fff3ee;
  color: #FF6B35;
}

/* "Всі категорії" button */
.category-item:first-child .category-link {
  background: linear-gradient(135deg, #FF6B35, #FF9A3C);
  color: white;
  border-radius: 8px;
  font-weight: 700;
}

.category-item:first-child .category-link:hover {
  background: linear-gradient(135deg, #e55a2b, #e8893a);
  color: white;
}

/* Mobile sidebar */
.mobile-nav-sidebar {
  background: #ffffff;
}

.mobile-nav-header {
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.mobile-search-wrapper {
  background: #f4f6f8;
  border-color: #e5e7eb;
}

.mobile-search-input {
  color: #1f2937;
}

.mobile-search-input::placeholder {
  color: #9ca3af;
}

.mobile-search-wrapper i {
  color: #9ca3af;
}

.mobile-menu-item {
  color: #374151;
}

.mobile-menu-item:hover {
  background: #fff3ee;
  border-left-color: #FF6B35;
  color: #FF6B35;
}

.mobile-menu-title {
  color: #9ca3af;
}

.item-badge {
  background: #f4f6f8;
  color: #6b7280;
}

.mobile-nav-close {
  background: #f4f6f8;
  border-color: #e5e7eb;
  color: #374151;
}

#live-search-results:empty,
#live-search-results-mobile:empty {
  display: none;
}