/* ===== BUSCADOR AVANZADO ===== */

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  animation: fadeIn 0.15s ease-out;
}

.search-overlay.show {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.search-container {
  width: 100%;
  max-width: 560px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  gap: 12px;
}

.search-icon {
  width: 24px;
  height: 24px;
  color: #9ca3af;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 18px;
  color: #111;
  background: transparent;
}

.search-input::placeholder {
  color: #9ca3af;
}

.search-clear {
  width: 28px;
  height: 28px;
  border: none;
  background: #e5e7eb;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 16px;
  transition: all 0.15s;
}

.search-clear.show {
  display: flex;
}

.search-clear:hover {
  background: #d1d5db;
  color: #374151;
}

.search-close {
  padding: 6px 12px;
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 12px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
}

.search-close:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

/* Filtros (preparado para futuro) */
.search-filters {
  display: none; /* Oculto por ahora */
  padding: 12px 20px;
  border-bottom: 1px solid #e5e7eb;
  gap: 8px;
  flex-wrap: wrap;
}

.search-filters.show {
  display: flex;
}

.search-filter {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
}

.search-filter:hover {
  border-color: var(--primary-color, #2563eb);
  color: var(--primary-color, #2563eb);
}

.search-filter.active {
  background: var(--primary-color, #2563eb);
  border-color: var(--primary-color, #2563eb);
  color: #fff;
}

/* Resultados */
.search-results {
  max-height: 400px;
  overflow-y: auto;
}

.search-section {
  padding: 8px 0;
}

.search-section-title {
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.1s;
}

.search-result-item:hover,
.search-result-item.selected {
  background: #f3f4f6;
}

.search-result-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
}

.search-result-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

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

.search-result-name {
  font-weight: 600;
  color: #111;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-username {
  color: #6b7280;
  font-size: 13px;
}

.search-result-meta {
  font-size: 12px;
  color: #9ca3af;
  text-align: right;
}

/* Estados */
.search-empty {
  padding: 40px 20px;
  text-align: center;
  color: #6b7280;
}

.search-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.search-loading {
  padding: 30px 20px;
  text-align: center;
}

.search-hint {
  padding: 20px;
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
}

/* Highlight de coincidencias */
.search-highlight {
  background: #fef08a;
  color: #854d0e;
  padding: 0 2px;
  border-radius: 2px;
}

/* Búsquedas recientes */
.search-recent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px 8px;
}

.search-recent-header span {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-recent-header button {
  background: none;
  border: none;
  color: var(--primary-color, #2563eb);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.search-recent-header button:hover {
  background: rgba(37, 99, 235, 0.1);
}

.search-recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.1s;
}

.search-recent-item:hover {
  background: #f3f4f6;
}

.search-recent-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 14px;
}

.search-recent-remove {
  margin-left: auto;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
  line-height: 1;
}

.search-recent-remove:hover {
  color: #ef4444;
}

/* Atajos de teclado */
.search-shortcuts {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 12px 20px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  font-size: 12px;
  color: #6b7280;
}

.search-shortcut {
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-shortcut kbd {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 11px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Responsive */
@media (max-width: 600px) {
  .search-overlay {
    padding-top: 0;
    align-items: stretch;
  }
  
  .search-container {
    max-width: none;
    border-radius: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .search-input-wrapper {
    padding-top: calc(16px + env(safe-area-inset-top));
  }
  
  .search-results {
    flex: 1;
    max-height: none;
  }
  
  .search-shortcuts {
    display: none;
  }
}
