/* portal.css — Portal del Paciente PROTOA */

/* ── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-page);
  color: var(--grafito);
  min-height: 100vh;
  line-height: 1.5;
}
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select { font-family: inherit; }

/* ── Variables ──────────────────────────────────────────────────────── */
:root {
  --indigo:    #312E81;
  --terracota: #C2410C;
  --marfil:    #FAFAF9;
  --blanco:    #FFFFFF;
  --grafito:   #44403C;
  --muted:     #78716C;
  --border:    #E7E5E4;
  --success:   #059669;
  --error:     #DC2626;

  /* [27/06/2026 portal-fase1] Paleta arena + Fraunces para coherencia con app */
  --bg-page:        #F5F1EA;
  --border-sand:    #D9D0BE;
  --border-sand-deep: #C9BEA4;
  --primary-tint:   #EEF2FF;
  --font-display:   'Fraunces', Georgia, 'Times New Roman', serif;
}

/* ── Layout ─────────────────────────────────────────────────────────── */
.portal-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.card {
  background: var(--blanco);
  border: 1px solid var(--border-sand);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 24px;
  width: 100%;
  max-width: 440px;
}

/* ── Marca ──────────────────────────────────────────────────────────── */
.portal-logo { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--indigo); letter-spacing: 0.06em; margin-bottom: 4px; }
.portal-logo-sub { font-size: 12px; color: var(--terracota); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }

/* ── Tipografía ─────────────────────────────────────────────────────── */
h1 { font-size: 20px; font-weight: 700; color: var(--grafito); margin-bottom: 8px; }
p  { color: var(--muted); font-size: 14px; line-height: 1.6; }

/* ── Botones ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 24px; border-radius: 8px;
  font-size: 15px; font-weight: 600; border: none;
  transition: opacity 0.15s; width: 100%; gap: 8px;
}
.btn:active { opacity: 0.85; }
.btn-primary   { background: var(--blanco); color: var(--indigo); border: 1.5px solid var(--indigo); box-shadow: 0 1px 3px rgba(49,46,129,0.10); font-weight: 700; }
.btn-primary:hover { background: var(--primary-tint); box-shadow: 0 3px 8px rgba(49,46,129,0.15); }
.btn-secondary { background: var(--blanco); border: 1px solid var(--border); color: var(--grafito); }
.btn-secondary:hover { background: var(--marfil); }
.btn-sm  { min-height: 36px; padding: 8px 16px; font-size: 13px; width: auto; }
.btn-xs  { min-height: 30px; padding: 5px 12px; font-size: 12px; width: auto; font-weight: 500; }
.btn-danger { background: #FEF2F2; border: 1px solid #FECACA; color: var(--error); }
.btn-danger:hover { background: #FEE2E2; }

/* Botón icono (ej. ⟳ actualizar) */
.btn-icon {
  background: none; border: none; color: var(--muted);
  font-size: 16px; padding: 4px 6px; border-radius: 6px;
  min-height: auto; width: auto; transition: color 0.15s, background 0.15s;
}
.btn-icon:hover { color: var(--indigo); background: var(--marfil); }

/* Spinner inline dentro de botón */
.btn-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite; flex-shrink: 0;
}
.btn-spinner.dark {
  border-color: rgba(49,46,129,0.3);
  border-top-color: var(--indigo);
}

/* ── Inputs / selects ───────────────────────────────────────────────── */
.input-wrap  { margin-bottom: 16px; }
.input-label { display: block; font-size: 13px; font-weight: 500; color: var(--grafito); margin-bottom: 6px; }
.input-field,
.select-field {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 16px; font-size: 16px; color: var(--grafito);
  background: var(--blanco); outline: none; transition: border-color 0.15s;
  appearance: none; -webkit-appearance: none;
}
.input-field:focus,
.select-field:focus { border-color: var(--indigo); }
.select-wrap { position: relative; }
.select-wrap::after {
  content: '▾'; position: absolute; right: 14px; top: 50%;
  transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: 13px;
}

/* ── Estados ────────────────────────────────────────────────────────── */
.estado-error {
  background: #FEF2F2; border: 1px solid #FECACA; border-radius: 8px;
  padding: 14px 16px; color: var(--error); font-size: 14px;
  line-height: 1.5; margin-bottom: 16px;
}
.estado-loading { text-align: center; color: var(--muted); font-size: 14px; padding: 32px 0; }
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid var(--border); border-top-color: var(--indigo);
  border-radius: 50%; animation: spin 0.7s linear infinite; margin-bottom: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Header dashboard ───────────────────────────────────────────────── */
.dash-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--blanco); border-bottom: 1px solid var(--border);
  padding: 14px 20px; display: flex; align-items: center; justify-content: space-between;
}
.dash-header-brand { display: flex; flex-direction: column; }
.dash-saludo { padding: 20px 20px 0; font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--indigo); letter-spacing: 0.01em; }

/* ── Tabs ───────────────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin: 16px 0 0; padding: 0 20px; }
.tab-btn {
  background: none; border: none; padding: 12px 0; margin-right: 24px;
  font-size: 14px; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s;
}
.tab-btn.active { color: var(--indigo); border-bottom-color: var(--indigo); font-weight: 600; }
.tab-panel { display: none; padding: 24px 20px; }
.tab-panel.active { display: block; }

/* ── Placeholder ────────────────────────────────────────────────────── */
.tab-placeholder { text-align: center; padding: 48px 24px; color: var(--muted); }
.tab-placeholder-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.tab-placeholder p { font-size: 14px; }

/* ── Sección citas ──────────────────────────────────────────────────── */
.citas-seccion { margin-bottom: 28px; }
.citas-seccion-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.citas-seccion-titulo {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em;
  font-weight: 600; color: var(--muted);
}

/* ── Cita card ──────────────────────────────────────────────────────── */
.cita-card {
  background: var(--blanco); border: 1px solid var(--border-sand);
  border-radius: 10px; padding: 16px; margin-bottom: 10px;
}
.citas-seccion .cita-card { border-left: 3px solid var(--indigo); }
.acordeon-body   .cita-card { border-left: 3px solid var(--border-sand-deep); }
.cita-card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.cita-fecha { font-size: 14px; font-weight: 600; color: var(--grafito); }
.cita-hora  { font-size: 20px; font-weight: 700; color: var(--indigo); line-height: 1; }
.cita-meta  { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.cita-meta span { font-size: 12px; color: var(--muted); background: var(--marfil); padding: 2px 8px; border-radius: 99px; }
.badge-pendiente {
  display: inline-block; background: #FFF7ED; border: 1px solid #FED7AA;
  color: var(--terracota); font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 99px; margin-bottom: 10px;
}
.cita-actions { margin-top: 12px; display: flex; gap: 8px; }

/* [03/07/2026 P3] Botón "Cancelar" mini en cita confirmada + modal contacto */
.btn-cancelar-mini {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border-sand);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  min-height: auto;
  width: auto;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-cancelar-mini:hover {
  color: var(--error);
  border-color: var(--error);
}
.cancel-contacto-btns {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 8px;
}
.cancel-contacto-btns a {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; text-decoration: none;
  background: var(--bg-page); color: var(--indigo);
  border: 1px solid var(--border-sand-deep);
  border-radius: 8px; padding: 10px 14px;
  font-size: 14px; font-weight: 600;
  transition: background 0.14s;
}
.cancel-contacto-btns a:hover { background: var(--primary-tint); }
.cancel-contacto-btns a.wa { color: #16A34A; }
/* En histórico (dentro del acordeón) NO mostramos el botón cancelar */
.acordeon-body .btn-cancelar-mini { display: none; }

/* [03/07/2026 P5] Botón Reprogramar mini + banner reprograma */
.btn-reprograma-mini {
  background: transparent;
  color: var(--indigo);
  border: 1px solid var(--border-sand-deep);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  min-height: auto; width: auto;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-reprograma-mini:hover { background: var(--primary-tint); }
.acordeon-body .btn-reprograma-mini { display: none; }

.banner-reprograma-box {
  background: var(--primary-tint);
  border: 1px solid var(--indigo);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.banner-reprograma-info { font-size: 13px; color: var(--indigo); line-height: 1.5; }
.banner-reprograma-info strong { display: block; font-weight: 700; margin-bottom: 2px; }
.btn-reprograma-cancel {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border-sand-deep);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  min-height: auto; width: auto;
  cursor: pointer;
}
.btn-reprograma-cancel:hover { color: var(--error); border-color: var(--error); }

/* ── Skeleton (3d) ──────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, #EDEDED 25%, #F5F5F5 50%, #EDEDED 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 6px;
}
.skeleton-card {
  background: var(--blanco); border: 1px solid var(--border-sand);
  border-radius: 10px; padding: 16px; margin-bottom: 10px;
}
.skeleton-line { height: 14px; margin-bottom: 10px; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.h-20 { height: 20px; }

/* ── Acordeón histórico ─────────────────────────────────────────────── */
.acordeon-historico { border: 1px solid var(--border-sand); border-radius: 10px; overflow: hidden; background: var(--blanco); }
.acordeon-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; cursor: pointer; user-select: none; }
.acordeon-header:hover { background: var(--marfil); }
.acordeon-titulo { font-size: 13px; font-weight: 600; color: var(--grafito); }
.acordeon-flecha { font-size: 14px; color: var(--muted); transition: transform 0.2s; }
.acordeon-body { display: none; border-top: 1px solid var(--border); padding: 12px 16px; }
.acordeon-body.abierto { display: block; }
.acordeon-flecha.abierto { transform: rotate(180deg); }

/* ── Estado vacío ───────────────────────────────────────────────────── */
.citas-vacio { text-align: center; padding: 48px 24px; color: var(--muted); }
.citas-vacio-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.4; }
.citas-vacio p { font-size: 14px; margin-bottom: 20px; }
.panel-error { background: #FEF2F2; border: 1px solid #FECACA; border-radius: 10px; padding: 20px; text-align: center; }
.panel-error p { color: var(--error); font-size: 14px; margin-bottom: 14px; }

/* ── Toast (3d) ─────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 999; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: #1C1917; color: #fff;
  padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  opacity: 0; transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none; white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #052e16; border: 1px solid #166534; }
.toast.error   { background: #450a0a; border: 1px solid #991b1b; }

/* ── Modal ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal-overlay.oculto { display: none; }
.modal-box {
  background: var(--blanco); border: 0.5px solid var(--border-sand); border-radius: 14px;
  padding: 28px 24px; width: 100%; max-width: 380px;
  box-shadow: 0 12px 32px rgba(49,46,129,0.12), 0 4px 8px rgba(0,0,0,0.04);
}
.modal-titulo { font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--indigo); margin-bottom: 12px; letter-spacing: 0.01em; }
.modal-detalle { font-size: 14px; color: var(--muted); line-height: 1.6; margin-bottom: 20px; }
.modal-detalle strong { color: var(--grafito); }
.modal-acciones { display: flex; gap: 10px; }
.modal-acciones .btn { flex: 1; }

/* ── Reservar (3c) ──────────────────────────────────────────────────── */
.reservar-form { max-width: 480px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.slots-wrap { margin-top: 20px; }
.slot-dia { margin-bottom: 20px; }
.slot-dia-fecha { font-size: 13px; font-weight: 600; color: var(--grafito); margin-bottom: 10px; text-transform: capitalize; }
.slot-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.slot-btn {
  background: var(--blanco); border: 1px solid var(--indigo);
  color: var(--indigo); border-radius: 8px; padding: 8px 14px;
  font-size: 14px; font-weight: 600; min-height: 40px; width: auto;
  transition: background 0.15s, color 0.15s;
}
.slot-btn:hover  { background: var(--indigo); color: var(--blanco); }
.slot-btn:disabled { background: var(--marfil); border-color: var(--border); color: var(--muted); cursor: not-allowed; }
.slots-vacio { text-align: center; padding: 36px 0; color: var(--muted); font-size: 14px; }

/* Botón "Ver más días" (3d) */
.btn-mas-dias {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 8px;
}

/* ── Utilidades ─────────────────────────────────────────────────────── */
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-center { text-align: center; }
.text-sm   { font-size: 13px; }
.text-muted { color: var(--muted); }

/* ══════════════════════════════════════════════════════════════════════
   CALENDARIO 7b
══════════════════════════════════════════════════════════════════════ */

.cal-controles { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 16px; }

.cal-vista { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.cal-mes-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-mes-label { font-size: 16px; font-weight: 700; color: var(--grafito); }
.cal-nav-btn {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--grafito); transition: background 0.15s; flex-shrink: 0;
}
.cal-nav-btn:hover:not(:disabled) { background: var(--marfil); }
.cal-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.cal-semana-header { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }
.cal-semana-header span {
  text-align: center; font-size: 11px; font-weight: 600;
  color: var(--muted); padding: 4px 0;
  text-transform: uppercase; letter-spacing: 0.05em;
}

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }

.cal-celda {
  aspect-ratio: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border-radius: 8px; position: relative;
  transition: background 0.1s; min-width: 0;
}
.cal-celda-num { font-size: 14px; font-weight: 600; line-height: 1; }
.cal-punto { width: 5px; height: 5px; border-radius: 50%; background: var(--indigo); margin-top: 3px; }

.cal-disponible { background: var(--blanco); cursor: pointer; }
.cal-disponible .cal-celda-num { color: var(--indigo); }
.cal-disponible:hover { background: var(--primary-tint); }

.cal-lleno { background: var(--blanco); cursor: default; }
.cal-lleno .cal-celda-num { color: #D1D5DB; }

.cal-no-laborable { background: var(--marfil); cursor: default; }
.cal-no-laborable .cal-celda-num { color: #E5E7EB; }

.cal-festivo, .cal-vacaciones { background: #FEF3C7; cursor: default; }
.cal-festivo .cal-celda-num, .cal-vacaciones .cal-celda-num { color: #92400E; }

.cal-pasado { background: transparent; cursor: default; opacity: 0.28; }
.cal-pasado .cal-celda-num { color: var(--muted); }

.cal-vacia { background: transparent; }
.cal-hoy { box-shadow: 0 0 0 2px var(--indigo), 0 3px 8px rgba(49,46,129,0.15); }
.cal-celda[title] { cursor: help; }

.cal-detalle-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.cal-back-btn {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; font-size: 13px; color: var(--grafito);
  display: flex; align-items: center; gap: 4px;
  transition: background 0.15s; flex-shrink: 0;
}
.cal-back-btn:hover { background: var(--marfil); }
.cal-detalle-fecha { font-size: 16px; font-weight: 700; color: var(--grafito); }

.cal-tramo { margin-bottom: 20px; }
.cal-tramo-titulo {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted); margin-bottom: 10px;
}
.cal-slots-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.cal-slot-pill {
  background: var(--blanco); border: 1.5px solid var(--indigo);
  color: var(--indigo); border-radius: 8px;
  padding: 8px 16px; font-size: 14px; font-weight: 600;
  transition: background 0.15s, color 0.15s;
  min-width: 64px; text-align: center;
}
.cal-slot-pill:hover { background: var(--indigo); color: var(--blanco); }

.cal-dia-vacio { text-align: center; padding: 36px 0; color: var(--muted); font-size: 14px; }

.cal-skeleton-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-skeleton-celda { aspect-ratio: 1; border-radius: 8px; }

/* [27/06/2026 portal-fase2] Hero chevron dashboard + fondo radial login */
.portal-hero {
  position: relative; overflow: hidden;
  height: 118px; background: #FAFAF9;
  border-bottom: 1px solid var(--border-sand);
}
.portal-hero-pat {
  position: absolute; inset: 0;
  width: 100%; height: 100%; display: block;
}
.portal-hero-layer {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; gap: 12px; flex-wrap: wrap;
}
.portal-pill {
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff; border: 0.5px solid #E7E5E4;
  border-radius: 9999px;
  box-shadow: 0 3px 10px rgba(49,46,129,0.08);
  padding: 8px 16px; line-height: 1; white-space: nowrap;
}
.portal-pill-brand {
  display: flex; flex-direction: column; gap: 2px;
}
.portal-pill-brand .b1 {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700; color: var(--indigo);
  letter-spacing: 0.06em; line-height: 1;
}
.portal-pill-brand .b2 {
  font-size: 9px; color: var(--terracota);
  text-transform: uppercase; letter-spacing: 0.07em;
}
.portal-pill-salir {
  background: transparent; border: 0;
  color: var(--indigo); font-family: inherit;
  font-size: 13px; font-weight: 600;
  cursor: pointer; padding: 0 4px;
  border-radius: 9999px; transition: background 0.14s;
  min-height: auto; width: auto;
}
.portal-pill-salir:hover {
  background: var(--primary-tint);
}
.portal-wrap-login {
  position: relative; min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 16px; overflow: hidden;
}
.login-bg-pat {
  position: absolute; inset: 0;
  width: 100%; height: 100%; display: block;
  pointer-events: none; z-index: 0;
}
.portal-wrap-login > .card {
  position: relative; z-index: 1;
}

