:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --secondary: #0f172a;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-focus: #38bdf8;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 2.2rem;
  background: var(--primary-light);
  padding: 6px 10px;
  border-radius: var(--radius-md);
}

.logo-text h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--secondary);
}

.logo-text h1 span {
  color: var(--primary);
}

.logo-text p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.header-badges {
  display: flex;
  gap: 8px;
}

.badge-tag {
  font-size: 0.75rem;
  padding: 4px 10px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 500;
  color: var(--text-muted);
}

.badge-free {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

/* Main */
.main-content {
  flex: 1;
  padding-top: 36px;
  padding-bottom: 60px;
}

/* Hero / Buscador */
.search-section {
  text-align: center;
  margin-bottom: 30px;
}

.search-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--secondary);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.search-subtitle {
  color: var(--text-muted);
  font-size: 0.98rem;
  max-width: 680px;
  margin: 0 auto 24px auto;
}

.search-box {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 6px 8px 6px 16px;
  box-shadow: var(--shadow-md);
  max-width: 760px;
  margin: 0 auto 16px auto;
  transition: all 0.2s ease;
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.15);
}

.search-icon {
  font-size: 1.2rem;
  margin-right: 10px;
  opacity: 0.7;
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-main);
}

.search-box input::placeholder {
  color: #94a3b8;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #ffffff;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--primary-light);
}

/* Quick Tags */
.quick-tags {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.chip {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-hover);
}

/* Filtros */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 240px;
}

.filter-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

.filter-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: #f8fafc;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.filter-group select:focus {
  border-color: var(--primary);
  background-color: #ffffff;
}

/* AI Insight Box */
.ai-box {
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 24px;
  animation: fadeIn 0.3s ease;
}

.ai-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.ai-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e40af;
}

.ai-content {
  font-size: 0.9rem;
  color: #1e3a8a;
  line-height: 1.6;
}

.ai-content p {
  margin-bottom: 6px;
}

.ai-content ul {
  padding-left: 20px;
  margin-bottom: 6px;
}

/* Resultados */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.results-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--secondary);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

/* Tarjeta de Equipo */
.equip-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.equip-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.card-top {
  margin-bottom: 14px;
}

.card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.badge-respiratorio { background: #e0f2fe; color: #0369a1; }
.badge-movilidad { background: #fef3c7; color: #b45309; }
.badge-cuidado { background: #dcfce7; color: #15803d; }
.badge-monitoreo { background: #f3e8ff; color: #7e22ce; }

.badge-modality {
  background: #f1f5f9;
  color: #475569;
}

.equip-card h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 6px;
}

.equip-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.equip-specs {
  list-style: none;
  font-size: 0.8rem;
  color: var(--text-main);
  background: #f8fafc;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.equip-specs li {
  margin-bottom: 4px;
}

.equip-specs li:last-child {
  margin-bottom: 0;
}

.equip-provider {
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px dashed var(--border);
  padding-top: 10px;
  margin-bottom: 14px;
}

.equip-provider strong {
  color: var(--text-main);
}

.card-actions {
  display: flex;
  gap: 8px;
}

.card-actions button {
  flex: 1;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: scaleUp 0.2s ease;
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 18px;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: #94a3b8;
  cursor: pointer;
}

.close-btn:hover {
  color: var(--secondary);
}

/* Footer */
.footer {
  background: #ffffff;
  border-top: 1px solid var(--border);
  padding: 24px 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: auto;
}

.footer-content {
  text-align: center;
}

.disclaimer {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 8px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 640px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .search-title {
    font-size: 1.5rem;
  }
  .search-box {
    flex-direction: column;
    padding: 10px;
    gap: 10px;
  }
  .btn-primary {
    width: 100%;
  }
  .filters-bar {
    flex-direction: column;
  }
}
