/**
 * Modal de Recherche Globale (Ctrl+K / Cmd+K) — Congrès SEP 2027
 * Charte Éducation Populaire Engagée — WCAG 2.2 AA Conforme
 */

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem 1rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.search-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.search-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 28, 48, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.search-modal-content {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 680px;
  max-height: 82vh;
  background: #ffffff;
  border: 1px solid rgba(0, 102, 138, 0.2);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(14, 28, 48, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(-16px) scale(0.98);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-modal.is-open .search-modal-content {
  transform: translateY(0) scale(1);
}

/* En-tête du champ de recherche */
.search-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #e7eeff;
  background: #f9f9ff;
}

.search-icon {
  font-size: 1.25rem;
  color: #00668a;
  display: flex;
  align-items: center;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-body, 'Geist', sans-serif);
  font-size: 1.05rem;
  font-weight: 500;
  color: #0e1c30;
}

.search-input::placeholder {
  color: #6e7880;
  font-weight: 400;
}

.search-close-btn {
  background: #e7eeff;
  border: 1px solid #dee8ff;
  color: #0e1c30;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.15s, transform 0.15s;
}

.search-close-btn:hover,
.search-close-btn:focus-visible {
  background: #d5e3ff;
  outline: 2px solid #00668a;
}

/* Filtres par boutons / chips */
.search-filters {
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid #e7eeff;
  background: #ffffff;
  overflow-x: auto;
  scrollbar-width: thin;
}

.search-filter-btn {
  background: #f0f3ff;
  border: 1px solid #dee8ff;
  color: #3e484f;
  font-family: var(--font-body, 'Geist', sans-serif);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 9999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.search-filter-btn:hover {
  background: #e7eeff;
  color: #0e1c30;
}

.search-filter-btn.active {
  background: #00668a;
  color: #ffffff;
  border-color: #00668a;
}

/* Corps des résultats */
.search-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  max-height: 460px;
  background: #ffffff;
}

.search-initial-state,
.search-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #6e7880;
  font-family: var(--font-body, 'Geist', sans-serif);
  font-size: 0.95rem;
}

.search-results-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-result-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #f9f9ff;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.search-result-item:hover,
.search-result-item.is-active {
  background: #e7eeff;
  border-color: #c4e7ff;
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-family: var(--font-display, 'Clash Display', sans-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: #0e1c30;
  line-height: 1.25;
  margin-bottom: 2px;
}

.search-result-desc {
  font-family: var(--font-body, 'Geist', sans-serif);
  font-size: 0.84rem;
  color: #3e484f;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-result-badge {
  flex-shrink: 0;
  font-family: var(--font-body, 'Geist', sans-serif);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #e7eeff;
  color: #00668a;
  border: 1px solid #c4e7ff;
}

.search-result-badge--actions,
.search-result-badge--action {
  background: #ffd9e1;
  color: #b5005c;
  border-color: #ffb1c6;
}

.search-result-badge--regions {
  background: #d4f4e2;
  color: #006c49;
  border-color: #a3e6c3;
}

.search-result-badge--delegue {
  background: #c4e7ff;
  color: #00668a;
  border-color: #7cd0ff;
}

/* Pied de la modale */
.search-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-top: 1px solid #e7eeff;
  background: #f9f9ff;
  font-family: var(--font-body, 'Geist', sans-serif);
  font-size: 0.78rem;
  color: #6e7880;
}

.search-footer kbd {
  display: inline-block;
  background: #ffffff;
  border: 1px solid #bec8d0;
  box-shadow: 0 1px 1px rgba(0,0,0,0.08);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0e1c30;
  margin: 0 2px;
}

@media (max-width: 640px) {
  .search-modal {
    padding: 0.75rem;
  }
  .search-footer {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
  }
}
