/* ==========================================================================
   ELISEE SCOUT — SEARCH BAR & SCRY STYLES (GLASSMORPHISM DARK THEME)
   Barra di ricerca unica in Bacheca annunci integrata con il Design System
   nativo (:root con --glass, --ink, --ink-2, --ink-3, --hover, --radius, --spring)
   ========================================================================== */

:root {
  --w: 240px;
  --row: 56px;
  --radius: 14px;
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --glass: rgb(38 38 40 / 42%);
  --ink: #f5f5f7;
  --ink-2: rgb(235 235 245 / 60%);
  --hover: rgb(255 255 255 / 8%);
  --ink-3: rgb(235 235 245 / 48%);
  --ease-open: cubic-bezier(.55, .08, .4, .95);
}

/* --------------------------------------------------------------------------
   1. Contenitore della barra di ricerca
   -------------------------------------------------------------------------- */
.search-bar-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto 20px auto;
  position: relative;
  z-index: 5;
}

.search-bar-container.is-suggest-open {
  z-index: 80;
}

.es-search-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 80;
  margin: 0;
  padding: 6px 4px 6px 6px;
  max-height: 320px;
  overflow-y: auto;
  background: #0d1626;
  background-color: #0d1626;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: 1px solid rgba(47, 224, 200, 0.28);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  scrollbar-width: thin;
  scrollbar-color: rgba(47, 224, 200, 0.55) #0d1626;
}

.es-search-suggest::-webkit-scrollbar {
  width: 10px;
}

.es-search-suggest::-webkit-scrollbar-track {
  background: #0d1626;
  border-radius: 999px;
  margin: 8px 0;
}

.es-search-suggest::-webkit-scrollbar-thumb {
  background: rgba(47, 224, 200, 0.45);
  border: 2px solid #0d1626;
  border-radius: 999px;
}

.es-search-suggest::-webkit-scrollbar-thumb:hover {
  background: rgba(47, 224, 200, 0.75);
}

.es-search-suggest[hidden] {
  display: none;
}

.es-search-suggest__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink, #f8fafc);
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.es-search-suggest__item.is-active,
.es-search-suggest__item:hover {
  background: rgba(47, 224, 200, 0.12);
}

.es-search-suggest__item:focus-visible {
  outline: 2px solid #2fe0c8;
  outline-offset: 2px;
}

.es-search-suggest__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.es-search-suggest__kind {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--es-ctrl-accent, #2fe0c8);
}

.es-search-suggest mark {
  background: transparent;
  color: var(--es-ctrl-accent, #2fe0c8);
  font-weight: 700;
}

html[data-theme="mimetico-chiaro"] .es-search-suggest {
  background: #ffffff;
  background-color: #ffffff;
  border-color: rgba(13, 148, 136, 0.35);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
  scrollbar-color: rgba(13, 148, 136, 0.55) #ffffff;
}

html[data-theme="mimetico-chiaro"] .es-search-suggest::-webkit-scrollbar-track {
  background: #ffffff;
}

html[data-theme="mimetico-chiaro"] .es-search-suggest::-webkit-scrollbar-thumb {
  background: rgba(13, 148, 136, 0.45);
  border-color: #ffffff;
}

html[data-theme="mimetico-chiaro"] .es-search-suggest__item {
  color: #0f172a;
}

@media (prefers-reduced-motion: reduce) {
  .es-search-suggest,
  .es-search-suggest * {
    animation: none;
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   2. Input Wrapper stilizzato in perfetta sintonia col tema glassmorphic
   -------------------------------------------------------------------------- */
.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  padding: 0 16px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(50px);
  backdrop-filter: blur(50px);
  border: 0;
  border-radius: var(--radius);
  box-shadow: 
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    0 16px 40px -12px rgba(0, 0, 0, 0.55);
  transition: box-shadow 400ms var(--spring), border-color 400ms var(--spring);
  box-sizing: border-box;
}

/* Stato di focus attivato */
.search-input-wrapper:focus-within {
  box-shadow: 
    inset 0 0 0 1px rgba(255, 255, 255, 0.4),
    0 0 20px rgba(56, 189, 248, 0.25);
}

/* --------------------------------------------------------------------------
   3. Campo di testo
   -------------------------------------------------------------------------- */
.search-input-wrapper input,
#main-search-input {
  flex: 1;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink) !important;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

.search-input-wrapper input::placeholder,
#main-search-input::placeholder {
  color: var(--ink-2);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   4. Pulsante Clear (X)
   -------------------------------------------------------------------------- */
.search-input-wrapper button,
#clear-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  transition: background 300ms var(--spring), color 300ms var(--spring), transform 200ms ease;
}

.search-input-wrapper button:hover,
#clear-search-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

.search-input-wrapper button:active,
#clear-search-btn:active {
  transform: scale(0.92);
}

/* Micro-animazione di invio (feedback visivo) */
.search-input-wrapper.submitted {
  box-shadow: 
    inset 0 0 0 1px rgba(31, 157, 107, 0.6),
    0 0 20px rgba(31, 157, 107, 0.35);
}

.search-input-wrapper.submitted button {
  background: rgba(31, 157, 107, 0.3) !important;
  color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   5. Supporto Light Mode (quando attivo html[data-theme="mimetico-chiaro"])
   -------------------------------------------------------------------------- */
html[data-theme="mimetico-chiaro"] {
  --glass: rgba(255, 255, 255, 0.7);
  --ink: #0e1830;
  --ink-2: rgba(14, 24, 48, 0.6);
  --hover: rgba(0, 0, 0, 0.06);
  --ink-3: rgba(14, 24, 48, 0.45);
}

html[data-theme="mimetico-chiaro"] .search-input-wrapper {
  box-shadow: 
    inset 0 0 0 0.5px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 16px 40px -12px rgba(0, 0, 0, 0.12);
}

html[data-theme="mimetico-chiaro"] .search-input-wrapper:focus-within {
  box-shadow: 
    inset 0 0 0 1px rgba(2, 132, 199, 0.5),
    0 0 16px rgba(2, 132, 199, 0.2);
}

/* --------------------------------------------------------------------------
   6. Nav Quick Search Trigger (Lente Header Desktop)
   -------------------------------------------------------------------------- */
.nav-search-trigger {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
  padding: 0;
  margin-right: 6px;
}

.nav-search-trigger:hover {
  transform: scale(1.08);
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="mimetico-chiaro"] .nav-search-trigger {
  color: #0e1830;
  border-color: #e2e8f0;
}
html[data-theme="mimetico-chiaro"] .nav-search-trigger:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
