/* css/header.css
   Шапка сайта (десктоп и мобильная адаптация)
   Вынесено из style.css без изменения содержимого правил. */

/* ===== ШАПКА (ПК) ===== */
.header {
  background: var(--surface-1); padding: 15px 20px;
  box-shadow: none; border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
}
.logo { font-size: 1.6em; color: var(--text-color); font-weight: 700; cursor: pointer; white-space: nowrap; }
.search-container {
  flex: 1;
  max-width: 400px;
  position: relative;
  margin: 0 20px;
}
/* На десктопе центрируем поиск строго по центру шапки, а не "между"
   лого и правым блоком — их ширины разные, поэтому flex:1 внутри
   justify-content:space-between не даёт визуального центра. .header
   уже position:sticky, поэтому это положенный контекст для абсолюта. */
@media (min-width: 1200px) {
  .search-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: clamp(240px, 32vw, 400px);
    margin: 0;
  }
}
#searchInput {
  width: 100%;
  padding: 10px 15px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: white;
  font-size: 0.9em;
  outline: none;
  transition: border-color 0.15s;
}
#searchInput:focus { border-color: var(--primary-color); }
#searchInput::placeholder { color: var(--text-muted); }
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-top: 5px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 150;
  display: none;
}
.search-results.active { display: block; }
.search-result-item {
  padding: 10px 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--surface-3); }
.search-result-image {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  object-fit: cover;
}
.search-result-name { flex: 1; color: var(--text-color); }
.search-result-price { color: var(--text-color); font-weight: bold; }

.header-right {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-left: auto;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.cart-widget, .auth-btn, .notifications-btn {
  background: var(--surface-2); padding: 10px 20px; border-radius: 10px;
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s; border: 1px solid var(--border-color); color: var(--text-color); font-size: 1em;
  white-space: nowrap;
}
.cart-widget .icon, .auth-btn .icon, .notifications-btn .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.notifications-btn {
  padding: 10px;
  border-radius: 10px;
  position: relative;
  width: 42px;
  height: 42px;
  justify-content: center;
  flex: 0 0 auto;
}
.cart-widget:hover, .auth-btn:hover, .notifications-btn:hover { background: var(--surface-3); border-color: var(--border-color-strong); }
.cart-badge {
  background: var(--primary-color); color: white; border-radius: 50%;
  width: 24px; height: 24px; display: inline-flex; align-items: center;
  justify-content: center; font-size: 0.8em; font-weight: bold;
}
.cart-sum { font-weight: 600; color: var(--text-color); margin-left: 5px; }

/* ===== МОБИЛЬНЫЕ (вертикальные) ===== */
@media (max-width: 1199px) {
  .header {
    flex-wrap: nowrap;
  }
  .search-container {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    margin: 0;
  }
  .header-right {
    gap: 10px;
  }
  .btn-text, .cart-sum {
    display: none;
  }
  .notifications-btn, .auth-btn, .cart-widget {
    padding: 10px;
    gap: 4px;
  }
}

@media (max-width: 768px) {
  .header {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
  }
  .logo { order: 1; font-size: 1.3em; }
  .header-right { order: 2; gap: 8px; }
  .search-container {
    order: 3;
    width: 100%;
    max-width: none;
    margin: 10px 0 0 0;
    flex: none;
  }
  .btn-text { display: none; }
  .cart-sum { display: none; }
  .notifications-btn, .auth-btn, .cart-widget {
    padding: 10px;
    gap: 4px;
  }
}

/* ===== МОБИЛЬНЫЕ (горизонтальные) ===== */

