/**
 * Search Modal, Input & Live Results Styles
 * Task ID: AUD-INT-001 - Interactive Form Accessibility & Feedback
 *
 * Implements:
 * - Subtle visual loading spinner
 * - ARIA live region styling
 * - Debounced interactive results dropdown
 * - WCAG AA accessible contrast & focus states
 */

/* ==========================================================================
   Contêiner do Formulário de Busca e Input
   ========================================================================== */
.gl-search-panel {
  position: relative;
}

.gl-search-form {
  position: relative;
  width: 100%;
}

.gl-search-form__field-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.gl-search-form__field,
.gl-search-form input[type="search"].search-input {
  width: 100%;
  height: 52px;
  padding: 0 88px 0 20px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--nav-text-main, #101828);
  background-color: #ffffff;
  border: 1.5px solid var(--nav-border-subtle, #d0d5dd);
  border-radius: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.gl-search-form__field:focus,
.gl-search-form input[type="search"].search-input:focus {
  border-color: var(--nav-brand-main, #4930c9);
  box-shadow: 0 0 0 4px rgba(73, 48, 201, 0.12);
  background-color: #ffffff;
}

.gl-search-form__field::placeholder {
  color: var(--nav-text-muted, #64748b);
  opacity: 0.85;
}

/* ==========================================================================
   Indicador Visual de Carregamento (Loading Spinner)
   ========================================================================== */
.gl-search-spinner {
  position: absolute;
  right: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.is-loading .gl-search-spinner,
.gl-search-form__field-wrap.is-loading .gl-search-spinner {
  opacity: 1;
  transform: scale(1);
}

.gl-spinner-icon {
  width: 20px;
  height: 20px;
  color: var(--nav-brand-main, #4930c9);
  animation: gl-search-spin 0.75s linear infinite;
}

@keyframes gl-search-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Botão de Submissão da Busca
   ========================================================================== */
.gl-search-form__submit {
  position: absolute;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--nav-text-muted, #475467);
  cursor: pointer;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.gl-search-form__submit:hover,
.gl-search-form__submit:focus-visible {
  color: var(--nav-brand-main, #4930c9);
  background-color: var(--nav-hover-bg, #f4f3ff);
}

.gl-search-form__submit:focus-visible {
  outline: 2px solid var(--nav-brand-main, #4930c9);
  outline-offset: 2px;
}

.gl-search-form__submit .gl-icon,
.gl-search-form__submit svg {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   Painel Suspenso de Resultados em Tempo Real
   ========================================================================== */
.gl-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 120;
  overflow: hidden;
  max-height: 440px;
  background-color: #ffffff;
  border: 1px solid var(--nav-border-subtle, #e4e7ec);
  border-radius: 16px;
  box-shadow: 0 16px 36px rgba(16, 24, 40, 0.1), 0 4px 12px rgba(16, 24, 40, 0.04);
}

.gl-search-results__list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  max-height: 360px;
  overflow-y: auto;
}

.gl-search-result-item {
  margin: 0;
  padding: 0;
}

.gl-search-result-link {
  display: block;
  padding: 12px 20px;
  text-decoration: none;
  border-bottom: 1px solid #f1f4f8;
  transition: background-color 0.15s ease;
}

.gl-search-result-item:last-child .gl-search-result-link {
  border-bottom: none;
}

.gl-search-result-link:hover,
.gl-search-result-link:focus {
  background-color: #f8fafc;
  outline: none;
}

.gl-search-result-link:focus-visible {
  background-color: #f4f3ff;
  outline: 2px solid var(--nav-brand-main, #4930c9);
  outline-offset: -2px;
}

.gl-search-result-title {
  display: block;
  font-size: 0.96rem;
  font-weight: 750;
  line-height: 1.35;
  color: var(--nav-text-main, #101828);
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}

.gl-search-result-link:hover .gl-search-result-title,
.gl-search-result-link:focus .gl-search-result-title {
  color: var(--nav-brand-main, #4930c9);
}

.gl-search-result-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.45;
}

.gl-search-results__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background-color: #fafbfc;
  border-top: 1px solid #eef2f6;
}

.gl-search-all-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 750;
  color: var(--nav-brand-main, #4930c9);
  text-decoration: none;
  transition: color 0.18s ease, transform 0.18s ease;
}

.gl-search-all-link:hover,
.gl-search-all-link:focus-visible {
  color: var(--nav-brand-vibrant, #5b3df5);
  transform: translateX(2px);
}

.gl-search-all-link:focus-visible {
  outline: 2px solid var(--nav-brand-main, #4930c9);
  outline-offset: 2px;
}

.gl-search-empty {
  padding: 26px 20px;
  text-align: center;
}

.gl-search-empty__msg {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--nav-text-main, #101828);
}

.gl-search-empty__hint {
  margin: 0;
  font-size: 0.82rem;
  color: #64748b;
}

/* ==========================================================================
   Acessibilidade e Região Oculta (Screen Reader Text)
   ========================================================================== */
.screen-reader-text.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
