/* ============================================================
   KINESIS · styles.css
   Sistema de diseño clínico-deportivo.
   Paleta: azul clínico profundo, verde-menta de recuperación,
   hueso cálido de fondo, coral para acentos de alerta/acción.
   ============================================================ */

:root {
  /* Color */
  --ink:        #14242E;
  --clinical:   #1B4965;
  --clinical-dark: #0F2E40;
  --recovery:   #4F9D94;
  --recovery-dark: #3A7A72;
  --bone:       #F7F4EE;
  --bone-deep:  #EFEAE0;
  --coral:      #E0653F;
  --line:       #DDD6C8;
  --white:      #FFFFFF;
  --success:    #3F8F5F;
  --danger:     #C0432D;

  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body:    "Inter", system-ui, sans-serif;

  --sidebar-w: 248px;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-card: 0 1px 2px rgba(20,36,46,0.06), 0 4px 14px rgba(20,36,46,0.06);
  --shadow-pop:  0 10px 40px rgba(20,36,46,0.18);
}

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

body {
  font-family: var(--font-body);
  background: var(--bone);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--clinical-dark);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   LAYOUT
   ============================================================ */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--clinical-dark);
  color: var(--bone);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 22px;
  border-bottom: 1px solid rgba(247,244,238,0.1);
}
.sidebar-brand .mark {
  width: 38px; height: 38px;
  background: var(--recovery);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-brand .mark svg { width: 22px; height: 22px; stroke: var(--clinical-dark); }
.sidebar-brand .name { font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--white); line-height: 1.1; }
.sidebar-brand .tag { font-size: 11px; color: rgba(247,244,238,0.55); letter-spacing: 0.04em; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: 14.5px; font-weight: 500; color: rgba(247,244,238,0.72);
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-nav a .num {
  font-family: var(--font-display); font-size: 12px;
  width: 20px; height: 20px; border-radius: 5px;
  background: rgba(247,244,238,0.08);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-nav a:hover { background: rgba(247,244,238,0.07); color: var(--white); }
.sidebar-nav a.active { background: var(--recovery); color: var(--clinical-dark); font-weight: 600; }
.sidebar-nav a.active .num { background: rgba(20,36,46,0.15); }

.sidebar-foot { padding: 16px 22px 22px; font-size: 11.5px; color: rgba(247,244,238,0.4); border-top: 1px solid rgba(247,244,238,0.1); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(247,244,238,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 16px 32px;
  display: flex; align-items: center; gap: 16px;
}
.topbar .search-wrap { flex: 1; max-width: 420px; position: relative; }
.topbar .search-wrap svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--clinical); opacity: 0.6; }
.topbar input[type="search"] {
  width: 100%; padding: 10px 14px 10px 38px;
  border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--white); font-size: 14px; color: var(--ink);
  outline: none; transition: border-color 0.15s ease;
}
.topbar input[type="search"]:focus { border-color: var(--recovery); }

.page-title-row { margin-left: auto; text-align: right; }
.page-title-row .eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--recovery-dark); font-weight: 600; }
.page-title-row h1 { font-size: 18px; }

.content { padding: 28px 32px 120px; max-width: 1280px; }

.bottom-nav { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .content { padding: 20px 16px 110px; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .page-title-row { width: 100%; text-align: left; margin-left: 0; order: 3; }

  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--clinical-dark);
    border-top: 1px solid rgba(247,244,238,0.1);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: rgba(247,244,238,0.55); font-size: 10.5px; padding: 6px 4px; border-radius: 8px; min-width: 44px;
  }
  .bottom-nav a svg { width: 19px; height: 19px; stroke: currentColor; }
  .bottom-nav a.active { color: var(--recovery); }
}

/* ============================================================
   HERO
   ============================================================ */

.hero {
  background: linear-gradient(135deg, var(--clinical) 0%, var(--clinical-dark) 100%);
  border-radius: var(--radius-lg);
  padding: 56px 48px;
  color: var(--white);
  position: relative;
  overflow: hidden;
  margin-bottom: 36px;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(79,157,148,0.35), transparent 70%);
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--bone); background: rgba(247,244,238,0.12);
  padding: 6px 12px; border-radius: 999px; margin-bottom: 18px;
}
.hero .eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--recovery); }
.hero h1 { color: var(--white); font-size: clamp(28px, 4vw, 42px); line-height: 1.12; max-width: 640px; margin-bottom: 14px; }
.hero p { color: rgba(247,244,238,0.78); font-size: 15.5px; max-width: 520px; line-height: 1.55; position: relative; z-index: 2; }

.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }

.module-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 24px 22px; display: flex; flex-direction: column; gap: 14px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  box-shadow: var(--shadow-card);
}
.module-card:hover { transform: translateY(-3px); border-color: var(--recovery); box-shadow: 0 14px 32px rgba(79,157,148,0.18); }
.module-card .step { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--recovery-dark); }
.module-card .icon-box { width: 46px; height: 46px; border-radius: var(--radius-sm); background: var(--bone-deep); display: flex; align-items: center; justify-content: center; }
.module-card .icon-box svg { width: 24px; height: 24px; stroke: var(--clinical); }
.module-card h3 { font-size: 17px; color: var(--ink); }
.module-card p { font-size: 13.5px; color: #5b6b73; line-height: 1.5; margin: 0; }
.module-card .go { margin-top: auto; font-size: 13px; font-weight: 600; color: var(--recovery-dark); display: flex; align-items: center; gap: 6px; }

/* ============================================================
   TABS
   ============================================================ */

.zone-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.zone-tab {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--white); font-size: 13.5px; font-weight: 500; color: var(--ink);
  transition: all 0.15s ease;
}
.zone-tab svg { width: 15px; height: 15px; stroke: currentColor; }
.zone-tab:hover { border-color: var(--recovery); }
.zone-tab.active { background: var(--clinical); border-color: var(--clinical); color: var(--white); }

/* ============================================================
   CARDS
   ============================================================ */

.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--recovery-dark); font-weight: 700; margin-bottom: 6px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 16px; margin-bottom: 28px; }

.item-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-md);
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow-card); transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.item-card:hover { border-color: var(--recovery); }
.item-card .thumb { background: var(--bone-deep); height: 120px; display: flex; align-items: center; justify-content: center; position: relative; }
.item-card .thumb svg { width: 44px; height: 44px; stroke: var(--clinical); opacity: 0.55; }
.item-card .thumb .zone-chip {
  position: absolute; top: 10px; left: 10px;
  background: rgba(20,36,46,0.78); color: var(--bone);
  font-size: 10.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; text-transform: capitalize;
}
.item-card .body { padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.item-card h4 { font-size: 15px; line-height: 1.3; color: var(--ink); }
.item-card .desc { font-size: 12.5px; color: #5b6b73; line-height: 1.45; flex: 1; margin: 0; }
.item-card .actions { display: flex; gap: 8px; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  padding: 9px 14px; transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; stroke: currentColor; }

.btn-primary { background: var(--recovery); color: var(--white); }
.btn-primary:hover { background: var(--recovery-dark); }
.btn-outline { background: transparent; color: var(--clinical); border: 1.5px solid var(--line); }
.btn-outline:hover { border-color: var(--clinical); }
.btn-ghost { background: transparent; color: var(--clinical); padding: 9px 10px; }
.btn-ghost:hover { background: var(--bone-deep); }

.btn-select { flex: 1; background: var(--white); color: var(--recovery-dark); border: 1.5px solid var(--recovery); }
.btn-select:hover { background: rgba(79,157,148,0.08); }
.btn-select.selected { background: var(--recovery); color: var(--white); }
.btn-select.selected::before { content: "✓ "; }

.btn-detail { flex: 1; background: var(--clinical); color: var(--white); }
.btn-detail:hover { background: var(--clinical-dark); }

.btn-sm { padding: 7px 11px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ============================================================
   FORMULARIO DE PACIENTE
   ============================================================ */

.patient-panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px 26px; margin-bottom: 30px; box-shadow: var(--shadow-card); }
.patient-panel .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.patient-panel .head h2 { font-size: 18px; }
.patient-panel .head .saved-pill {
  font-size: 11.5px; color: var(--success); background: rgba(63,143,95,0.1);
  padding: 5px 11px; border-radius: 999px; font-weight: 600; display: none; align-items: center; gap: 6px;
}
.patient-panel .head .saved-pill.show { display: flex; }
.patient-panel .head .saved-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--clinical-dark); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--ink); background: var(--bone); outline: none; transition: border-color 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--recovery); background: var(--white); }
.field textarea { resize: vertical; min-height: 70px; }

/* ============================================================
   MODAL
   ============================================================ */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,46,64,0.55); backdrop-filter: blur(2px);
  z-index: 100; display: none; align-items: flex-start; justify-content: center;
  padding: 4vh 16px; overflow-y: auto;
}
.modal-overlay.open { display: flex; }

.modal-box { background: var(--white); border-radius: var(--radius-lg); max-width: 680px; width: 100%; box-shadow: var(--shadow-pop); margin-bottom: 4vh; }
.modal-box.wide { max-width: 820px; }

.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 22px 26px 16px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--white); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-head .zone-chip-lg { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--recovery-dark); margin-bottom: 6px; }
.modal-head h3 { font-size: 19px; line-height: 1.3; }
.modal-close { background: var(--bone-deep); border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--clinical); }
.modal-close:hover { background: var(--line); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body { padding: 22px 26px 26px; }

.tx-section { margin-bottom: 22px; }
.tx-section:last-child { margin-bottom: 0; }
.tx-section h4 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--recovery-dark);
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.tx-section h4::before { content: ""; width: 4px; height: 14px; background: var(--recovery); border-radius: 2px; }
.tx-section p { font-size: 14px; line-height: 1.6; color: var(--ink); margin: 0 0 4px; }
.tx-section ul { margin: 0; padding-left: 20px; }
.tx-section li { font-size: 14px; line-height: 1.65; color: var(--ink); margin-bottom: 4px; }

.tx-subgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tx-subgrid .sub-item { background: var(--bone); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.tx-subgrid .sub-item.full { grid-column: 1 / -1; }
.tx-subgrid .sub-item .k { font-size: 11px; font-weight: 700; color: var(--clinical); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 4px; display: block; }
.tx-subgrid .sub-item .v { font-size: 13.5px; line-height: 1.5; color: var(--ink); }

.tx-section.contra { background: rgba(224,101,63,0.08); border-radius: var(--radius-md); padding: 16px 18px; }
.tx-section.contra h4 { color: var(--coral); }
.tx-section.contra h4::before { background: var(--coral); }

.step-list { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step-list li { counter-increment: step; position: relative; padding-left: 32px; margin-bottom: 12px; font-size: 14px; line-height: 1.6; color: var(--ink); }
.step-list li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; border-radius: 50%; background: var(--clinical); color: var(--white);
  font-size: 11.5px; font-weight: 700; font-family: var(--font-display);
  display: flex; align-items: center; justify-content: center;
}

.video-placeholder {
  background: var(--clinical-dark); border-radius: var(--radius-md); aspect-ratio: 16/9;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: rgba(247,244,238,0.65); margin-bottom: 20px;
}
.video-placeholder svg { width: 36px; height: 36px; stroke: var(--recovery); }
.video-placeholder span { font-size: 12.5px; }

.modal-foot { display: flex; gap: 10px; padding: 18px 26px 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ============================================================
   FLOATING ROUTINE COUNTER + REVIEW BAR
   ============================================================ */

.routine-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  background: var(--clinical-dark); color: var(--white); border-radius: 999px;
  padding: 13px 20px 13px 16px; display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-pop); transition: transform 0.15s ease;
}
.routine-fab:hover { transform: translateY(-2px); }
.routine-fab .count {
  background: var(--recovery); color: var(--clinical-dark); font-family: var(--font-display);
  font-weight: 700; font-size: 13px; min-width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.routine-fab span.label { font-size: 13.5px; font-weight: 600; }
.routine-fab svg { width: 16px; height: 16px; stroke: currentColor; }

@media (max-width: 900px) { .routine-fab { bottom: 76px; right: 16px; } }
.routine-fab.hidden { display: none; }

.page-actions {
  display: flex; gap: 12px; flex-wrap: wrap;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 18px 20px; margin-top: 8px; align-items: center;
}
.page-actions .info { font-size: 13px; color: #5b6b73; margin-right: auto; }

.summary-list { list-style: none; margin: 0 0 16px; padding: 0; }
.summary-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.summary-list li:last-child { border-bottom: none; }
.summary-list li .meta { color: #5b6b73; font-size: 12px; }
.summary-list li button { background: none; border: none; color: var(--coral); font-size: 12px; font-weight: 600; }

.patient-summary-box { background: var(--bone); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 18px; font-size: 13.5px; line-height: 1.6; }
.patient-summary-box strong { color: var(--clinical-dark); }
.patient-summary-box .empty { color: var(--coral); font-weight: 600; }

.empty-state { text-align: center; padding: 60px 20px; color: #8a9499; }
.empty-state svg { width: 40px; height: 40px; stroke: #b9c0c3; margin-bottom: 12px; }
.empty-state p { font-size: 14px; margin: 0; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--clinical-dark); color: var(--white); padding: 13px 20px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-pop); z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease;
  display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }

@media (max-width: 600px) {
  .hero { padding: 36px 24px; }
  .modal-foot { flex-direction: column; }
  .modal-foot .btn { width: 100%; }
  .page-actions { flex-direction: column; align-items: stretch; }
  .page-actions .info { margin-right: 0; }
}

.img-titulo {
  width: 100%;             /* Ocupa todo el ancho disponible */
  height: auto;            /* Mantiene la proporción */
  max-height: 360px;       /* Limita la altura para no ocupar demasiada pantalla */
  object-fit: cover;       /* Recorta la imagen limpiamente si es necesario */
  border-radius: 6px;      /* Bordes redondeados para que combine con el diseño */
  margin-bottom: 16px;     /* Separa la imagen del título (H4) que está debajo */
  display: block;
}