/* ============================================================
   DELTA SHOP — Search overlay
   ============================================================ */

/* ── Кнопка поиска в шапке ────────────────────────────────── */
.search-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}
.search-btn:hover { border-color: var(--accent); color: var(--accent); }
.search-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--btn-primary-text);
}

/* ── Оверлей поиска ───────────────────────────────────────── */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;            /* ниже header (1001), но выше всего остального */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.search-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

/* Панель с инпутом и результатами */
.search-panel {
  position: absolute;
  top: var(--header-h);
  left: 0; right: 0;
  z-index: 2;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  padding: 16px 0 20px;
  transform: translateY(-6px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.search-overlay.is-open .search-panel {
  transform: translateY(0);
}

/* Полупрозрачный фон под панелью */
.search-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 1;
}

/* ── Поле ввода ───────────────────────────────────────────── */
.search-field {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 14px;
  transition: border-color var(--transition);
}
.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.search-field__icon {
  color: var(--text-muted);
  flex-shrink: 0;
  display: flex; align-items: center;
  transition: color var(--transition);
}
.search-field:focus-within .search-field__icon { color: var(--accent); }

.search-field__input {
  flex: 1;
  height: 52px;
  background: transparent;
  border: none;
  outline: none;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-primary);
  font-family: var(--font-main);
  min-width: 0;
}
.search-field__input::placeholder { color: var(--text-muted); }
.search-field__input::-webkit-search-cancel-button,
.search-field__input::-webkit-search-decoration { display: none; }

@media (max-width: 480px) {
  .search-field__input { height: 46px; font-size: 0.9rem; }
}

.search-field__clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex; align-items: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
}
.search-field__clear.is-visible { opacity: 1; pointer-events: all; }
.search-field__clear:hover { color: var(--accent); background: var(--bg-card); }

/* ── Результаты ───────────────────────────────────────────── */
.search-results {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  max-height: 380px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
@media (max-width: 600px) { .search-results { max-height: 52vh; } }

.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition);
  outline: none;
}
.search-result:hover,
.search-result.is-active { background: var(--bg-secondary); }
.search-result.is-active { outline: 2px solid rgba(var(--accent-rgb), 0.4); }

.search-result__img {
  width: 46px; height: 46px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.search-result__img img { width: 100%; height: 100%; object-fit: cover; }

.search-result__info { flex: 1; min-width: 0; }

.search-result__brand {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}

.search-result__name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}
.search-result__name mark {
  background: rgba(var(--accent-rgb), 0.2);
  color: var(--accent);
  border-radius: 2px;
  padding: 0 1px;
  font-weight: 600;
}

.search-result__cat {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.search-result__right { text-align: right; flex-shrink: 0; }
.search-result__price {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.search-result__stock {
  font-size: 0.68rem;
  color: #22c55e;
  margin-top: 2px;
  white-space: nowrap;
}
.search-result__stock--out { color: var(--text-muted); }

/* Заглушки */
.search-tip {
  padding: 28px 12px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}
.search-tip__icon { font-size: 2rem; margin-bottom: 10px; opacity: 0.35; }

.search-empty {
  padding: 28px 12px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.search-empty strong { color: var(--text-secondary); }

.search-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 12px;
  opacity: 0.6;
}

/* Подвал результатов */
.search-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.search-footer__link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: opacity var(--transition);
}
.search-footer__link:hover { opacity: 0.8; }

.search-kbd {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.72rem;
}
.search-kbd kbd {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 0.7rem;
  color: var(--text-secondary);
}
@media (max-width: 480px) { .search-kbd { display: none; } }
