/* ==========================================================================
   Fammie Fami S.A. — Buscador interno
   ========================================================================== */

/* Search trigger button in header */
.search-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--steel-200);
  border-radius: 6px; padding: 6px 12px;
  cursor: pointer; color: var(--steel-500);
  font-family: inherit; font-size: .82rem;
  transition: border-color .2s, color .2s;
  white-space: nowrap;
}
.search-trigger:hover,
.search-trigger:focus-visible {
  border-color: var(--brand); color: var(--brand);
  outline: none;
}
.search-trigger svg { width: 16px; height: 16px; flex-shrink: 0; }
.search-trigger-text { pointer-events: none; }

/* Compact mode: icon only below 900px */
@media (max-width: 899px) {
  .search-trigger-text { display: none; }
  .search-trigger { padding: 6px 8px; }
}

/* Overlay */
.search-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(7,26,51,.55);
  display: none; align-items: flex-start; justify-content: center;
  padding: 80px 16px 16px;
  opacity: 0; transition: opacity .2s;
}
.search-overlay.is-open { display: flex; }
.search-overlay.is-visible { opacity: 1; }

/* Dialog */
.search-dialog {
  background: #fff; border-radius: 12px;
  width: 100%; max-width: 620px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 120px);
  transform: translateY(-12px); transition: transform .2s;
}
.search-overlay.is-visible .search-dialog { transform: translateY(0); }

/* Input row */
.search-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--steel-100);
}
.search-input-row svg { width: 20px; height: 20px; color: var(--steel-400); flex-shrink: 0; }
.search-input {
  flex: 1; border: none; outline: none;
  font-family: inherit; font-size: 1rem; color: var(--navy-950);
  background: transparent;
}
.search-input::placeholder { color: var(--steel-400); }
.search-close {
  background: none; border: none; cursor: pointer;
  color: var(--steel-400); padding: 4px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s;
}
.search-close:hover { color: var(--navy-950); }
.search-close svg { width: 18px; height: 18px; }

/* Results */
.search-results {
  overflow-y: auto; padding: 8px 0;
  flex: 1; min-height: 0;
}
.search-results:empty { display: none; }

.search-result-item {
  display: block; padding: 12px 20px;
  text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--steel-50);
  transition: background .15s;
}
.search-result-item:hover,
.search-result-item:focus-visible,
.search-result-item.is-active {
  background: var(--surface, #f5f7fa);
  outline: none;
}
.search-result-title {
  font-weight: 600; font-size: .92rem;
  color: var(--brand, #125AA3); margin: 0 0 4px;
}
.search-result-snippet {
  font-size: .82rem; line-height: 1.5;
  color: var(--steel-600); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.search-result-url {
  font-size: .72rem; color: var(--steel-400); margin: 4px 0 0;
}

mark {
  background: rgba(18,90,163,.12); color: inherit;
  border-radius: 2px; padding: 0 1px;
}

/* Status messages */
.search-status {
  padding: 24px 20px; text-align: center;
  color: var(--steel-500); font-size: .88rem;
}

/* Footer hint */
.search-footer {
  padding: 10px 20px; border-top: 1px solid var(--steel-100);
  display: flex; align-items: center; gap: 12px;
  font-size: .72rem; color: var(--steel-400);
}
.search-footer kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 5px;
  background: var(--steel-50); border: 1px solid var(--steel-200);
  border-radius: 4px; font-family: inherit; font-size: .7rem;
}

/* Mobile */
@media (max-width: 599px) {
  .search-overlay { padding: 12px 8px; }
  .search-dialog { max-height: calc(100vh - 40px); border-radius: 10px; }
  .search-footer { display: none; }
}
