/* Global search-overlay — past in vintage cabinet aesthetic. */

/* Header-knop */
.header-search-btn {
  background: none;
  border: 1px solid rgba(232, 154, 60, 0.35);
  border-radius: 6px;
  color: var(--amber, #e89a3c);
  cursor: pointer;
  padding: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.header-search-btn:hover,
.header-search-btn:focus-visible {
  border-color: var(--amber);
  color: var(--amber-glow, #ffb84d);
  outline: none;
}
.header-search-icon {
  width: 18px;
  height: 18px;
  display: block;
}

/* Modal backdrop + sheet */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 7vh 16px 16px;
  pointer-events: none;
}
.search-modal:not([hidden]) {
  pointer-events: auto;
}
.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 14, 8, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: search-backdrop-in 0.18s ease both;
}
@keyframes search-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.search-sheet {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 12vh);
  background: var(--paper, #f5f3ec);
  border: 1.5px solid var(--wood-dark, #3a2818);
  border-radius: 8px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: search-sheet-in 0.22s ease both;
  font-family: var(--font-sans, system-ui);
}
@keyframes search-sheet-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.search-sr-only {
  position: absolute;
  width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0);
}

/* Input rij */
.search-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(58, 40, 24, 0.18);
  background: linear-gradient(180deg,
              rgba(232, 154, 60, 0.05),
              transparent);
}
.search-input-icon {
  width: 18px;
  height: 18px;
  color: var(--wood-dark, #3a2818);
  opacity: 0.55;
  flex-shrink: 0;
}
.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-sans, system-ui);
  font-size: 17px;
  color: var(--wood-dark, #3a2818);
  outline: none;
  padding: 4px 0;
}
.search-input::placeholder {
  color: rgba(58, 40, 24, 0.45);
}
.search-close-btn {
  background: none;
  border: 1px solid rgba(58, 40, 24, 0.2);
  border-radius: 5px;
  color: var(--wood-dark, #3a2818);
  cursor: pointer;
  font-size: 14px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}
.search-close-btn:hover { opacity: 1; }

/* Results-blok */
.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 12px;
  min-height: 80px;
}
.search-empty-hint,
.search-no-results,
.search-loading {
  color: rgba(58, 40, 24, 0.55);
  font-size: 13px;
  padding: 18px 20px;
  text-align: center;
  font-style: italic;
}

/* Country-groep */
.search-group {
  padding: 8px 0 4px;
}
.search-group + .search-group {
  border-top: 1px dashed rgba(58, 40, 24, 0.15);
  margin-top: 4px;
}
.search-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(58, 40, 24, 0.55);
}
.search-group-flag {
  width: 18px;
  height: 13px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.search-group-count {
  margin-left: auto;
  opacity: 0.7;
  font-weight: 500;
}

/* Result-row */
.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background 0.1s ease;
}
.search-result:hover,
.search-result.is-focused,
.search-result:focus-visible {
  background: rgba(232, 154, 60, 0.12);
  outline: none;
}
.search-result-logo {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  background: var(--wood-mid, #5a3e26);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--paper);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  overflow: hidden;
}
.search-result-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.search-result-info {
  flex: 1;
  min-width: 0;
}
.search-result-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--wood-dark, #3a2818);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-meta {
  font-size: 11px;
  color: rgba(58, 40, 24, 0.55);
  letter-spacing: 0.04em;
  margin-top: 1px;
}
.search-result-chip {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(58, 40, 24, 0.55);
  background: rgba(58, 40, 24, 0.08);
  padding: 3px 7px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Pulse animatie voor de play-toggle als de gebruiker een tap nodig heeft:
   - .search-needs-tap: na een mislukte auto-play vanuit de search overlay
   - body[data-player-state="paused"]: bij gewone pauze, zodat 't slot
     duidelijk maakt dat er nog wat te starten valt
   Beide gebruiken dezelfde keyframes. Bij playing/loading/idle geen puls. */
@keyframes search-tap-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
  50%      { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
}
.search-needs-tap #player-toggle,
body[data-player-state="paused"] #player-toggle {
  animation: search-tap-pulse 1.5s ease-in-out infinite;
  border-radius: 50%;
}
/* Retro-radio power-knob ook laten pulsen bij paused — visueel
   onderdeel van dezelfde toggle (klik delegeert naar #player-toggle). */
@keyframes rr-knob-pulse {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(74, 222, 128, 0)); }
  50%      { filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.55)); }
}
body[data-player-state="paused"] #rr-power-knob {
  animation: rr-knob-pulse 1.5s ease-in-out infinite;
}

/* Highlighted station-card op country-page na klik in search */
@keyframes search-highlight-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 154, 60, 0); }
  20%      { box-shadow: 0 0 0 4px rgba(232, 154, 60, 0.55); }
  60%      { box-shadow: 0 0 0 6px rgba(232, 154, 60, 0.25); }
}
.station-card.is-search-highlight {
  animation: search-highlight-pulse 2s ease-in-out;
}

/* Small screen tweaks */
@media (max-width: 540px) {
  .search-modal { padding-top: 4vh; padding-left: 8px; padding-right: 8px; }
  .search-sheet { max-height: calc(100vh - 6vh); }
  .search-input-row { padding: 12px 14px; }
  .search-input { font-size: 16px; }
}
