/**
 * ==============================================================================
 * WEBNATCORE — SISTEMA DE DISEÑO UX/UI EJECUTIVO & SOBRIO (css/portal.css)
 * ==============================================================================
 * 
 * Principios de Diseño:
 * 1. Estandarización estricta: Todos los inputs, selects y botones miden exactamente 44px.
 * 2. Jerarquía tipográfica controlada: Todos los labels a 13px font-weight 600.
 * 3. Paleta sobria institucional: Fondos limpios (#ffffff, #f8fafc), carbón pizarra (#0f172a, #334155),
 *    acento petrol teal (#0f766e) y bordes neutros (#e2e8f0, #cbd5e1).
 * 4. Máxima presentabilidad y legibilidad clínica.
 * ==============================================================================
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --std-font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --std-primary: #0f766e;
  --std-primary-hover: #115e59;
  --std-dark: #0f172a;
  --std-slate: #334155;
  --std-muted: #64748b;
  --std-bg: #f8fafc;
  --std-surface: #ffffff;
  --std-border: #e2e8f0;
  --std-border-input: #cbd5e1;
  --std-radius: 6px;
  --std-control-height: 44px;
}

/* Reset y Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-family: var(--std-font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--std-bg);
  color: var(--std-slate);
  line-height: 1.55;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ══════════════════════════════════════════════════════════════════════
   1. TOPBAR CORPORATIVA SOBRIA
   ══════════════════════════════════════════════════════════════════════ */
.portal-topbar {
  background-color: var(--std-dark);
  color: #94a3b8;
  font-size: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.portal-topbar-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar-items-left, .topbar-items-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
}

.topbar-item i {
  color: #94a3b8;
}

.topbar-badge-sober {
  background-color: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════════════
   2. NAVBAR PRINCIPAL
   ══════════════════════════════════════════════════════════════════════ */
.portal-navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: #ffffff;
  border-bottom: 1px solid var(--std-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.portal-nav-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.portal-logo {
  max-height: 44px;
  width: auto;
}

.portal-brand-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--std-dark);
  letter-spacing: -0.02em;
}

.portal-nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.portal-nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--std-slate);
  padding: 6px 0;
  transition: color 0.15s ease;
}

.portal-nav-link:hover, .portal-nav-link.active {
  color: var(--std-primary);
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════════════
   3. SISTEMA DE CONTROLES ESTANDARIZADOS (STRICT FORM SYSTEM)
   Inputs, selects y botones de exactamente 44px; labels a 13px font-weight 600.
   ══════════════════════════════════════════════════════════════════════ */
.std-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.std-label {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #374151 !important;
  margin: 0 !important;
  display: block !important;
  line-height: 1.25 !important;
}

.std-input,
.std-select {
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  padding: 0 14px !important;
  font-size: 14px !important;
  font-family: inherit !important;
  color: var(--std-dark) !important;
  background-color: #ffffff !important;
  border: 1px solid var(--std-border-input) !important;
  border-radius: var(--std-radius) !important;
  box-sizing: border-box !important;
  width: 100% !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.std-input:focus,
.std-select:focus {
  outline: none !important;
  border-color: var(--std-primary) !important;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12) !important;
}

.std-btn {
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  padding: 0 20px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  font-family: inherit !important;
  border-radius: var(--std-radius) !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: all 0.15s ease !important;
}

.std-btn-primary {
  background-color: var(--std-primary) !important;
  color: #ffffff !important;
  border: 1px solid var(--std-primary) !important;
}

.std-btn-primary:hover {
  background-color: var(--std-primary-hover) !important;
  border-color: var(--std-primary-hover) !important;
}

.std-btn-secondary {
  background-color: #ffffff !important;
  color: var(--std-slate) !important;
  border: 1px solid var(--std-border-input) !important;
}

.std-btn-secondary:hover {
  background-color: #f8fafc !important;
  border-color: #94a3b8 !important;
  color: var(--std-dark) !important;
}

/* ══════════════════════════════════════════════════════════════════════
   4. SECCIÓN HERO Y MÓDULO DE CONSULTA DIRECTA DE RESULTADOS
   ═══════════════════════════════════════════════════════════════════ */
.std-hero-section {
  padding: 50px 0 60px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--std-border);
}

.std-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

.std-hero-header {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 36px;
}

.std-hero-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--std-muted);
  background-color: #f1f5f9;
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--std-border);
}

.std-hero-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--std-dark);
  line-height: 1.25;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.std-hero-desc {
  font-size: 15px;
  color: var(--std-muted);
  line-height: 1.6;
}

/* Caja Ejecutiva de Consulta de Resultados */
.std-query-panel {
  background-color: #ffffff;
  border: 1px solid var(--std-border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  padding: 24px;
  max-width: 1060px;
  margin: 0 auto;
}

.std-query-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--std-border);
  margin-bottom: 20px;
}

.std-query-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--std-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.std-demo-link {
  font-size: 13px;
  color: var(--std-primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.std-query-grid {
  display: grid;
  grid-template-columns: 140px 1.1fr 1.1fr 200px;
  gap: 14px;
  align-items: flex-end;
}

.std-query-note {
  font-size: 12px;
  color: var(--std-muted);
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ══════════════════════════════════════════════════════════════════════
   5. CATÁLOGO DE EXÁMENES Y CONDICIONES PRE-ANALÍTICAS
   ══════════════════════════════════════════════════════════════════════ */
.std-section {
  padding: 60px 0;
  border-bottom: 1px solid var(--std-border);
}

.std-section-header {
  margin-bottom: 30px;
}

.std-section-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--std-dark);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.std-section-subtitle {
  font-size: 14px;
  color: var(--std-muted);
}

/* Barra de Búsqueda Estandarizada */
.std-search-row {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 10px;
  margin-bottom: 20px;
}

.std-cat-pills-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.std-cat-pill {
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 4px;
  background-color: #ffffff;
  border: 1px solid var(--std-border);
  color: var(--std-slate);
  cursor: pointer;
  transition: all 0.15s ease;
}

.std-cat-pill:hover {
  border-color: #94a3b8;
  color: var(--std-dark);
}

.std-cat-pill.active {
  background-color: var(--std-dark);
  border-color: var(--std-dark);
  color: #ffffff;
  font-weight: 600;
}

/* Grilla de Tarjetas de Exámenes */
.std-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.std-exam-card {
  background-color: #ffffff;
  border: 1px solid var(--std-border);
  border-radius: 6px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.std-exam-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.std-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.std-code-badge {
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  background-color: #f1f5f9;
  color: #475569;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid #e2e8f0;
  display: inline-block;
  margin-bottom: 6px;
}

.std-exam-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--std-dark);
  line-height: 1.35;
}

.std-exam-price {
  text-align: right;
  flex-shrink: 0;
  margin-left: 12px;
}

.std-price-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--std-muted);
}

.std-price-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--std-dark);
}

.std-specs-box {
  background-color: #f8fafc;
  border: 1px solid #edf2f7;
  border-radius: 4px;
  padding: 10px 12px;
  margin: 12px 0;
}

.std-spec-item {
  display: flex;
  font-size: 12px;
  margin-bottom: 4px;
}

.std-spec-item:last-child {
  margin-bottom: 0;
}

.std-spec-label {
  font-weight: 600;
  color: #64748b;
  width: 75px;
  flex-shrink: 0;
}

.std-spec-val {
  color: #1e293b;
  font-weight: 500;
}

.std-exam-desc {
  font-size: 13px;
  color: var(--std-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.std-card-footer {
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
}

/* ══════════════════════════════════════════════════════════════════════
   6. SECCIÓN DE HORARIOS DE ATENCIÓN Y SEDES
   ══════════════════════════════════════════════════════════════════════ */
.std-sedes-box {
  background-color: #ffffff;
  border: 1px solid var(--std-border);
  border-radius: 6px;
  overflow: hidden;
}

.std-sedes-tabs {
  display: flex;
  background-color: #f8fafc;
  border-bottom: 1px solid var(--std-border);
  overflow-x: auto;
}

.std-sede-tab {
  height: 44px;
  padding: 0 20px;
  font-size: 13px;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--std-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.std-sede-tab:hover {
  color: var(--std-dark);
}

.std-sede-tab.active {
  color: var(--std-dark);
  border-bottom-color: var(--std-primary);
  background-color: #ffffff;
}

.std-sede-body {
  padding: 28px;
}

.std-sede-panel {
  display: none;
}

.std-sede-panel.active {
  display: block;
}

.std-schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 16px;
}

.std-schedule-table th {
  background-color: #f1f5f9;
  color: #334155;
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--std-border);
}

.std-schedule-table td {
  padding: 12px 14px;
  border: 1px solid var(--std-border);
  color: var(--std-dark);
}

/* ══════════════════════════════════════════════════════════════════════
   7. MODALES (INFORME CLÍNICO & PREPARACIÓN PREVIA)
   ══════════════════════════════════════════════════════════════════════ */
.std-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.std-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.std-modal-dialog {
  background-color: #ffffff;
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.std-modal-header {
  padding: 16px 24px;
  background-color: var(--std-dark);
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.std-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
}

.std-modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.std-modal-close:hover {
  color: #ffffff;
}

.std-modal-body {
  padding: 24px;
  overflow-y: auto;
}

/* Estilos de Informe Clínico */
.std-report-container {
  background: #ffffff;
  border: 1px solid var(--std-border);
  border-radius: 6px;
  padding: 24px;
}

.std-report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--std-dark);
  margin-bottom: 20px;
}

.std-report-lab-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--std-dark);
  letter-spacing: 0.04em;
}

.std-report-lab-sub {
  font-size: 12px;
  color: var(--std-muted);
}

.std-report-order-box {
  text-align: right;
}

.std-report-order-num {
  font-family: monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--std-dark);
  display: block;
}

.std-report-badge-validated {
  font-size: 11px;
  font-weight: 700;
  color: #065f46;
  background-color: #ecfdf5;
  padding: 2px 8px;
  border-radius: 3px;
  display: inline-block;
  margin-top: 4px;
}

.std-patient-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  background-color: #f8fafc;
  padding: 12px 16px;
  border-radius: 4px;
  border: 1px solid #edf2f7;
  margin-bottom: 20px;
}

.std-pdata-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--std-muted);
  display: block;
}

.std-pdata-val {
  font-size: 13px;
  color: var(--std-dark);
}

.std-group-title {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--std-border);
  margin-bottom: 10px;
}

.std-results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.std-results-table th {
  background-color: #f8fafc;
  color: #475569;
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--std-border);
}

.std-results-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
}

.std-badge-alert {
  color: #991b1b;
  font-weight: 700;
  font-size: 11px;
}

.std-report-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--std-border);
}

/* Toast de Notificación */
.std-toast-notice {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--std-dark);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.2s ease;
  pointer-events: none;
}

.std-toast-notice.show {
  opacity: 1;
  transform: translateY(0);
}

/* ══════════════════════════════════════════════════════════════════════
   8. FOOTER CORPORATIVO
   ══════════════════════════════════════════════════════════════════════ */
.portal-footer {
  background-color: #0f172a;
  color: #94a3b8;
  padding: 40px 0 20px;
  font-size: 13px;
}

.portal-footer-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px 30px;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-brand-title {
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}

.footer-col h4 {
  color: #ffffff;
  font-size: 14px;
  margin-bottom: 12px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  color: #94a3b8;
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: #ffffff;
}

.footer-bottom {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

/* Media Queries Responsivos */
@media (max-width: 960px) {
  .std-query-grid {
    grid-template-columns: 1fr 1fr;
  }
  .portal-footer-container {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .portal-topbar {
    display: none;
  }
  .portal-nav-links {
    display: none;
  }
  .std-query-grid {
    grid-template-columns: 1fr;
  }
  .std-search-row {
    grid-template-columns: 1fr;
  }
  .std-patient-grid {
    grid-template-columns: 1fr 1fr;
  }
  .portal-footer-container {
    grid-template-columns: 1fr;
  }
}