/* ============================================================
   MPH+ Assessment Card — Stylesheet
============================================================ */

/* ── Tokens ────────────────────────────────────────────────── */
:root {
  --deep-scene:    #0D1B2A;
  --field-surface: #1A2B3C;
  --surface-2:     #1f3347;
  --surface-3:     #243d56;
  --alert-red:     #CC2936;
  --tech-white:    #F0F2F4;
  --gray:          #7B8FA6;
  --amber:         #E8960C;
  --success:       #6FCF97;
  --cyan:          #4DC9CC;
  --blue:          #3D7CC9;

  --font-heading: 'Barlow Condensed', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --gutter: 16px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  background: var(--deep-scene);
  color: var(--tech-white);
  font-family: var(--font-body);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Layout ────────────────────────────────────────────────── */
#ac-shell { max-width: 1100px; margin: 0 auto; padding: 0 var(--gutter) 60px; }

/* ── Top nav ───────────────────────────────────────────────── */
.ac-nav-back {
  font-family: var(--font-heading); font-size: .78rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--gray); text-decoration: none;
  transition: color .15s;
}
.ac-nav-back:hover { color: var(--tech-white); }

.ac-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--surface-2);
  margin-bottom: 0;
  position: sticky;
  top: 0;
  background: var(--deep-scene);
  z-index: 100;
}
.ac-nav-brand {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.ac-nav-brand span { color: var(--success); }
.ac-nav-actions    { display: flex; gap: 10px; align-items: center; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}
.btn:hover   { opacity: .88; }
.btn:active  { transform: scale(.97); }
.btn--primary   { background: var(--success); color: #071a0e; }
.btn--secondary { background: var(--surface-2); color: var(--tech-white); }
.btn--ghost     { background: transparent; border: 1px solid var(--surface-3); color: var(--gray); }
.btn--danger    { background: var(--alert-red); color: #fff; }
.btn--sm        { padding: 5px 10px; font-size: .8rem; }
.btn:disabled   { opacity: .35; cursor: not-allowed; }

/* ── Tab navigation ────────────────────────────────────────── */
.ac-tabs-wrap {
  position: sticky;
  top: 53px;
  background: var(--deep-scene);
  z-index: 99;
  border-bottom: 1px solid var(--surface-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ac-tabs-wrap::-webkit-scrollbar { display: none; }

.ac-tabs {
  display: flex;
  gap: 0;
  min-width: max-content;
  padding: 8px var(--gutter) 0;
}
.ac-tab {
  font-family: var(--font-heading);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 7px 14px;
  background: transparent;
  color: var(--gray);
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  position: relative;
}
.ac-tab:hover          { color: var(--tech-white); }
.ac-tab.is-active      { color: var(--tech-white); border-bottom-color: var(--success); }
.ac-tab-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  margin-left: 5px;
  vertical-align: middle;
  opacity: 0;
  transition: opacity .2s;
}
.ac-tab.has-data .ac-tab-dot { opacity: 1; }

/* ── Section panels ────────────────────────────────────────── */
.ac-section        { display: none; padding: 24px 0 8px; }
.ac-section.is-active { display: block; }

.ac-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.ac-section-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.1;
}
.ac-section-badge {
  font-family: var(--font-heading);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 3px 8px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  color: var(--gray);
}
.ac-disclaimer {
  font-size: .8rem;
  color: var(--gray);
  background: var(--field-surface);
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 8px 12px;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ── Form grid ─────────────────────────────────────────────── */
.ac-form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.ac-form-grid--2 { grid-template-columns: repeat(2, 1fr); }
.ac-form-grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 700px) {
  .ac-form-grid,
  .ac-form-grid--2,
  .ac-form-grid--4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .ac-form-grid,
  .ac-form-grid--2,
  .ac-form-grid--4 { grid-template-columns: 1fr; }
}

.ac-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ac-field--full { grid-column: 1 / -1; }

.ac-label {
  font-family: var(--font-heading);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray);
}
.ac-label.required::after { content: ' *'; color: var(--alert-red); }

input[type=text],
input[type=date],
input[type=time],
input[type=number],
input[type=tel],
select,
textarea {
  background: var(--field-surface);
  border: 1px solid var(--surface-3);
  border-radius: var(--radius-sm);
  color: var(--tech-white);
  font-family: var(--font-body);
  font-size: .9rem;
  padding: 8px 10px;
  width: 100%;
  transition: border-color .15s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--success);
}
textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
select option { background: var(--field-surface); }
input::placeholder, textarea::placeholder { color: var(--surface-3); }

.ac-toggle-group {
  display: flex;
  gap: 6px;
}
.ac-toggle {
  flex: 1;
  padding: 8px 6px;
  background: var(--field-surface);
  border: 1px solid var(--surface-3);
  border-radius: var(--radius-sm);
  color: var(--gray);
  font-family: var(--font-body);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background .15s, color .15s, border-color .15s;
}
.ac-toggle.is-active-yes { background: rgba(111,207,151,.15); border-color: var(--success); color: var(--success); }
.ac-toggle.is-active-no  { background: rgba(204,41,54,.12);   border-color: var(--alert-red); color: var(--alert-red); }

/* ── Subsection label ──────────────────────────────────────── */
.ac-subsection {
  font-family: var(--font-heading);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 10px;
  margin-top: 4px;
}

/* ── Vitals table ──────────────────────────────────────────── */
.ac-vitals-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 16px; }
.ac-vitals-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  min-width: 680px;
}
.ac-vitals-table th {
  font-family: var(--font-heading);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--success);
  background: var(--field-surface);
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}
.ac-vitals-table td {
  padding: 8px 10px;
  border-top: 1px solid var(--surface-2);
  vertical-align: middle;
}
.ac-vitals-table tr:nth-child(even) td { background: rgba(31,51,71,.3); }
.ac-vital-val { font-weight: 600; }
.ac-vital-val.is-warning { color: var(--amber); }
.ac-vital-val.is-danger  { color: var(--alert-red); }
.ac-table-action { padding: 4px 8px; font-size: .75rem; }

.ac-vitals-add-btn { margin-bottom: 16px; }

/* Vitals entry form */
.ac-vitals-entry-panel {
  background: var(--field-surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}
.ac-vitals-entry-panel.ac-hidden { display: none; }

/* ── Body silhouette ───────────────────────────────────────── */
.ac-silhouette-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 520px) { .ac-silhouette-wrap { grid-template-columns: 1fr; } }

.ac-silhouette-panel {
  background: var(--field-surface);
  border-radius: var(--radius-lg);
  padding: 12px;
  border: 1px solid var(--surface-2);
}
.ac-silhouette-label {
  font-family: var(--font-heading);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gray);
  text-align: center;
  margin-bottom: 8px;
}

.ac-svg-body { display: block; width: 100%; max-width: 200px; margin: 0 auto; touch-action: manipulation; }

/* Clickable zones */
.body-zone {
  fill: rgba(61, 124, 201, 0.07);
  stroke: rgba(61, 124, 201, 0.25);
  stroke-width: 0.7;
  cursor: pointer;
  transition: fill .15s, stroke .15s;
}
.body-zone:hover {
  fill: rgba(61, 124, 201, 0.22);
  stroke: rgba(77, 201, 204, 0.6);
}
.body-zone.has-mark {
  stroke: rgba(111, 207, 151, 0.5);
}

/* Marks */
.ac-mark-circle {
  cursor: pointer;
  transition: r .15s;
}
.ac-mark-circle:hover { r: 5; }

/* Mark type popup */
.ac-mark-popup {
  position: fixed;
  background: var(--field-surface);
  border: 1px solid var(--surface-3);
  border-radius: var(--radius-md);
  padding: 12px;
  z-index: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  min-width: 220px;
}
.ac-mark-popup.ac-hidden { display: none; }
.ac-popup-title {
  font-family: var(--font-heading);
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 10px;
}
.ac-popup-zone-name {
  font-size: .8rem;
  color: var(--cyan);
  margin-bottom: 10px;
}
.ac-popup-types {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 10px;
}
.ac-type-btn {
  padding: 7px 8px;
  border: 1px solid var(--surface-3);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--tech-white);
  font-size: .8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .12s;
}
.ac-type-btn:hover       { background: var(--surface-3); }
.ac-type-btn .ac-dot     { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ac-type-btn[data-tipo="dolor"]      .ac-dot { background: #CC2936; }
.ac-type-btn[data-tipo="herida"]     .ac-dot { background: #E8960C; }
.ac-type-btn[data-tipo="quemadura"]  .ac-dot { background: #F5C518; }
.ac-type-btn[data-tipo="deformidad"] .ac-dot { background: #9B72CF; }
.ac-type-btn[data-tipo="hematoma"]   .ac-dot { background: #4A90D9; }
.ac-type-btn[data-tipo="sangrado"]   .ac-dot { background: #8B0000; }
.ac-type-btn[data-tipo="edema"]      .ac-dot { background: #4DC9CC; }
.ac-type-btn[data-tipo="otros"]      .ac-dot { background: #7B8FA6; }
.ac-popup-cancel {
  width: 100%;
  padding: 6px;
  background: transparent;
  border: 1px solid var(--surface-3);
  border-radius: var(--radius-sm);
  color: var(--gray);
  font-size: .8rem;
  cursor: pointer;
}

/* Marks legend */
.ac-marks-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  font-size: .78rem;
}
.ac-legend-item { display: flex; align-items: center; gap: 4px; color: var(--gray); }
.ac-legend-dot  { width: 8px; height: 8px; border-radius: 50%; }

/* Marks list */
.ac-marks-list { display: flex; flex-direction: column; gap: 5px; margin-top: 12px; }
.ac-mark-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: var(--field-surface);
  border-radius: var(--radius-sm);
  font-size: .85rem;
}
.ac-mark-entry .ac-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ac-mark-vista { font-family: var(--font-heading); font-size: .7rem; color: var(--gray); }
.ac-mark-delete { margin-left: auto; }

/* ── Dynamic list section (devices, interventions, reassessments) */
.ac-list-panel {
  background: var(--field-surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
}
.ac-list-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.ac-list-panel-title {
  font-family: var(--font-heading);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--tech-white);
}
.ac-list-panel-time {
  font-family: var(--font-heading);
  font-size: .95rem;
  font-weight: 700;
  color: var(--cyan);
}
.ac-list-empty {
  font-size: .85rem;
  color: var(--gray);
  padding: 12px;
  text-align: center;
  border: 1px dashed var(--surface-3);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.ac-entries-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }

/* ── Device checkboxes ─────────────────────────────────────── */
.ac-device-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}
@media (max-width: 600px) { .ac-device-grid { grid-template-columns: 1fr 1fr; } }

.ac-device-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--field-surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .875rem;
  transition: background .12s, border-color .12s;
}
.ac-device-check:hover           { background: var(--surface-2); }
.ac-device-check.is-active       { border-color: var(--success); background: rgba(111,207,151,.07); }
.ac-device-check input[type=checkbox] { display: none; }
.ac-device-checkbox-mark {
  width: 16px; height: 16px;
  border: 1.5px solid var(--surface-3);
  border-radius: 3px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.ac-device-check.is-active .ac-device-checkbox-mark {
  background: var(--success);
  border-color: var(--success);
}
.ac-device-check.is-active .ac-device-checkbox-mark::after {
  content: '✓';
  font-size: .65rem;
  color: #071a0e;
  font-weight: 900;
}
.ac-device-detail {
  background: var(--field-surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
}

/* ── Navigation row ────────────────────────────────────────── */
.ac-nav-row {
  display: flex;
  justify-content: space-between;
  padding: 16px 0 8px;
  border-top: 1px solid var(--surface-2);
  margin-top: 20px;
}

/* ── Utility ───────────────────────────────────────────────── */
.ac-hidden  { display: none !important; }
.ac-divider { height: 1px; background: var(--surface-2); margin: 20px 0; }

/* ── Anexos / file upload ──────────────────────────────────── */
.ac-file-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--field-surface);
  border: 1px dashed var(--surface-3);
  border-radius: var(--radius-sm);
  color: var(--gray);
  font-size: .875rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  min-height: 38px;
}
.ac-file-label:hover {
  border-color: var(--success);
  background: rgba(111,207,151,.05);
  color: var(--tech-white);
}
.ac-anexo-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-2);
  object-fit: contain;
  display: block;
}

/* ── Responsive vitals trend mini-bar ──────────────────────── */
.ac-trend-bar {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 20px;
}
.ac-trend-segment {
  flex: 1;
  min-height: 3px;
  max-height: 20px;
  border-radius: 2px 2px 0 0;
  background: var(--success);
  opacity: .7;
  transition: opacity .15s;
}
.ac-trend-segment:hover { opacity: 1; }
