﻿:root {
  --primary-bg: #faf9f6;
  --secondary-bg: #f4f6f8;
  --tertiary-bg: #eef2f6;
  --card-bg: #ffffff;
  --text-primary: #2d2d2d;
  --text-secondary: #5a5a5a;
  --text-muted: #8a8f98;
  --accent: #4ecdc4;
  --accent-hover: #3aa8a0;
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-bg-dark: rgba(245, 243, 239, 0.6);
  --glass-border: rgba(255, 255, 255, 0.55);
  --transition: all 0.25s ease;
}

html[data-theme="dark"] {
  --primary-bg: #0f141d;
  --secondary-bg: #151c27;
  --tertiary-bg: #1b2432;
  --card-bg: #141c26;
  --text-primary: #e6edf7;
  --text-secondary: #c0cad8;
  --text-muted: #8f9aad;
  --glass-bg: rgba(16, 22, 32, 0.78);
  --glass-bg-dark: rgba(9, 14, 22, 0.72);
  --glass-border: rgba(255, 255, 255, 0.14);
}

html[data-theme="dark"] body {
  background: var(--primary-bg);
  color: var(--text-primary);
}

html[data-theme="dark"] .main-header {
  border-bottom-color: rgba(78, 205, 196, 0.12);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.24);
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-bottom: 1px solid rgba(78, 205, 196, 0.18);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
  margin: 0 16px 20px 16px;
  max-width: calc(1400px - 32px);
  margin-left: auto;
  margin-right: auto;
  overflow: visible;
}

.logo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.admin-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.main-header .logo {
  margin: 0;
  font-size: inherit;
  line-height: 1;
}

/* Логотип — стеклянный блик */
.logo a {
  color: var(--accent);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', 'Segoe UI', Roboto, sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  text-decoration: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.logo a::before {
  content: "✨";
  font-size: 1.4rem;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.05));
}

.logo a::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.25) 0%,
    transparent 60%
  );
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 1;
}

.logo a:hover::after {
  opacity: 1;
}

.main-header .theme-switch {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  cursor: pointer;
  flex: 0 0 auto;
  z-index: 2;
}

.main-header .theme-switch-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.main-header .theme-switch-track {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  display: inline-flex;
  align-items: center;
  padding: 2px;
  transition: var(--transition);
}

.main-header .theme-switch-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transform: translateX(0);
  transition: transform 0.25s ease;
}

.main-header .theme-switch-input:checked + .theme-switch-track .theme-switch-thumb {
  transform: translateX(20px);
}

.main-header .theme-switch:hover .theme-switch-track {
  background: rgba(78, 205, 196, 0.12);
}

/* Поисковая строка — Liquid Glass */
.header-center {
  flex: 1;
  max-width: 500px;
  margin: 0 20px;
}

.header-center form {
  display: flex;
  position: relative;
}

.header-center input {
  width: 100%;
  padding: 12px 20px;
  padding-left: 44px;
  border-radius: var(--border-radius-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.header-center input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 
    0 0 0 2px rgba(78, 205, 196, 0.2),
    0 2px 16px rgba(78, 205, 196, 0.08);
  background: rgba(255, 255, 255, 0.9);
}

.header-center input::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

/* Лупа */
.header-center form::before {
  content: "🔍";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  color: var(--text-secondary);
  font-size: 1rem;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.03));
}

/* Правая часть — clear icons */
.header-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

.header-right a {
  position: relative;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 10px 7px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  min-width: 86px;
  height: 56px;
  justify-content: center;
  overflow: visible;
}

.header-right .header-theme-btn {
  position: relative;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 10px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  width: 48px;
  height: 48px;
  justify-content: center;
  cursor: pointer;
}

.header-right a span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 0;
  white-space: nowrap;
  line-height: 1;
  text-align: center;
}

.header-right .header-theme-btn span {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
  white-space: nowrap;
}

.header-right a:hover {
  transform: translateY(-3px) scale(1.05);
  background: rgba(78, 205, 196, 0.1);
  color: var(--accent);
  box-shadow: 
    0 6px 20px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(78, 205, 196, 0.1);
}

.header-right .header-theme-btn:hover {
  transform: translateY(-3px) scale(1.05);
  background: rgba(78, 205, 196, 0.1);
  color: var(--accent);
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(78, 205, 196, 0.1);
}

.header-right a i {
  font-size: 1.16rem;
  color: var(--accent);
  line-height: 1;
}

.header-right .header-theme-btn i {
  font-size: 1.2rem;
  color: var(--accent);
}

/* Счётчик корзины — стеклянный бейдж (светлый) */
.cart-counter,
.notification-counter {
  position: absolute;
  top: 4px;
  right: 6px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-primary);
  font-size: 0.64rem;
  font-weight: 700;
  width: 18px;
  min-width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 
    0 1px 3px rgba(0,0,0,0.08),
    inset 0 1px 0 rgba(255,255,255,0.8);
  font-family: -apple-system, SF Pro Rounded, sans-serif;
  line-height: 1;
  transform: translateZ(0);
}

/* Выпадающее меню — светлое, как Control Center */
.dropdown-menu,
.notifications-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(48px) saturate(180%);
  -webkit-backdrop-filter: blur(48px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.08),
    0 6px 16px rgba(78, 205, 196, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  min-width: 220px;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.user-dropdown:hover .dropdown-menu,
.notifications-dropdown:hover .notifications-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item,
.notification-item {
  padding: 12px 16px;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  position: relative;
}

.dropdown-item:last-child,
.notification-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover,
.notification-item:hover {
  background: rgba(78, 205, 196, 0.08);
  color: var(--accent);
}

.dropdown-item i,
.notification-item i {
  width: 16px;
  text-align: center;
  color: var(--text-secondary);
}

.dropdown-item:hover i,
.notification-item:hover i {
  color: var(--accent);
}

/* Уведомления — читаемость */
.notification-item.unread {
  background: rgba(78, 205, 196, 0.06);
  border-left: 3px solid var(--accent);
}

.notification-content {
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--text-primary);
}

.notification-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Мобильная панель — Floating Dock (светлая) */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: max(6px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 500px;
  background: var(--glass-bg);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 28px 28px 12px 12px;
  padding: 14px 0;
  z-index: 999;
  overflow: hidden;
  will-change: transform;
  backface-visibility: hidden;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
}

.mobile-nav a {
  color: var(--text-secondary);
  font-size: 1.3rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  padding: 10px 8px;
  border-radius: 16px;
  transition: var(--transition);
  flex: 1;
  min-width: 0;
  max-width: 80px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  margin: 0 6px;
}

.mobile-nav .mobile-theme-btn {
  color: var(--text-secondary);
  font-size: 1.3rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  padding: 10px 8px;
  border-radius: 16px;
  transition: var(--transition);
  flex: 1;
  min-width: 0;
  max-width: 80px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  margin: 0 6px;
  cursor: pointer;
}

.mobile-nav a:hover,
.mobile-nav a.active {
  color: var(--accent);
  background: rgba(78, 205, 196, 0.1);
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(78, 205, 196, 0.12);
}

.mobile-nav .mobile-theme-btn:hover {
  color: var(--accent);
  background: rgba(78, 205, 196, 0.1);
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(78, 205, 196, 0.12);
}

.mobile-nav a span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.mobile-nav .mobile-theme-btn span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.mobile-nav .cart-counter,
.mobile-nav .notification-counter {
  top: 1px;
  right: 5px;
  width: 17px;
  min-width: 17px;
  height: 17px;
  padding: 0;
  font-size: 0.65rem;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

html[data-theme="dark"] .cart-counter,
html[data-theme="dark"] .notification-counter,
html[data-theme="dark"] .mobile-nav .cart-counter,
html[data-theme="dark"] .mobile-nav .notification-counter {
  background: #0f1725;
  color: #f8fbff;
  border-color: #263144;
  box-shadow:
    0 1px 4px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.admin-header-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -10px auto 14px auto;
  padding: 8px;
  width: calc(100% - 32px);
  max-width: calc(1400px - 32px);
  overflow-x: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(26px) saturate(160%);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.admin-strip-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  white-space: nowrap;
  color: var(--text-primary);
  border: 1px solid transparent;
  transition: var(--transition);
  font-weight: 700;
  font-size: 0.82rem;
}

.admin-strip-link i {
  color: var(--accent);
  font-size: 0.92rem;
}

.admin-strip-counter {
  position: static;
  margin-left: 2px;
  width: 18px;
  min-width: 18px;
  height: 18px;
  font-size: 0.64rem;
}

.admin-strip-link:hover {
  background: rgba(78, 205, 196, 0.12);
  border-color: rgba(78, 205, 196, 0.28);
}

.admin-strip-link.active {
  background: rgba(78, 205, 196, 0.18);
  border-color: rgba(78, 205, 196, 0.42);
}

/* Адаптивность — без изменений, только цвета уже обновлены */
@media (max-width: 1024px) {
  .main-header {
    padding: 14px 18px;
    margin: 0 12px 20px 12px;
    max-width: calc(100% - 24px);
  }
}

@media (max-width: 768px) {
  .desktop-buttons {
    display: none !important;
  }
  .header-center {
    display: none;
  }
  .main-header {
    padding: 12px 14px;
    justify-content: space-between;
    align-items: center;
    margin: 0 8px 20px 8px;
    max-width: calc(100% - 16px);
    border-radius: 0 0 20px 20px;
  }
  .main-header .logo-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .logo a {
    font-size: 1.4rem;
  }
  .main-header .theme-switch {
    margin-left: 8px;
  }
  .main-header .theme-switch-track {
    width: 42px;
    height: 24px;
  }
  .main-header .theme-switch-thumb {
    width: 18px;
    height: 18px;
  }
  .main-header .theme-switch-input:checked + .theme-switch-track .theme-switch-thumb {
    transform: translateX(18px);
  }
  .admin-header-strip {
    width: calc(100% - 16px);
    max-width: calc(100% - 16px);
    margin: -12px 8px 12px 8px;
  }
  .header-right {
    gap: 14px;
  }
  .header-right a {
    width: 44px;
    height: 44px;
    padding: 8px;
  }
  .header-right .header-theme-btn {
    width: 44px;
    height: 44px;
    padding: 8px;
  }
  .mobile-nav {
    display: flex;
    justify-content: center;
    left: 8px;
    right: 8px;
    width: auto;
    transform: none;
    bottom: max(8px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 480px) {
  .main-header {
    padding: 10px 12px;
    margin: 0 6px 16px 6px;
  }
  .logo a {
    font-size: 1.3rem;
  }
  .header-right a {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    padding: 6px;
  }
  .mobile-nav {
    left: 6px;
    right: 6px;
    padding: 12px 0;
    bottom: max(6px, env(safe-area-inset-bottom));
  }
  .mobile-nav a {
    font-size: 1.2rem;
    padding: 8px 6px;
    gap: 3px;
    margin: 0 4px;
    max-width: 20%;
  }
  .mobile-nav .mobile-theme-btn {
    font-size: 1.2rem;
    padding: 8px 6px;
    gap: 3px;
    margin: 0 4px;
    max-width: 20%;
  }
  .mobile-nav a span {
    font-size: 0.7rem;
  }
  .mobile-nav .mobile-theme-btn span {
    font-size: 0.7rem;
  }
  .admin-header-strip {
    width: calc(100% - 12px);
    max-width: calc(100% - 12px);
    margin: -10px 6px 10px 6px;
    padding: 7px;
  }
  .admin-strip-link {
    padding: 7px 10px;
    font-size: 0.78rem;
  }
}

