/* autism.css — Nivelato UI — clean professional SaaS */

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

:root {
  --white:    #ffffff;
  --grey-50:  #f8f9fa;
  --grey-100: #f1f3f5;
  --grey-200: #e9ecef;
  --grey-300: #dee2e6;
  --grey-400: #ced4da;
  --grey-500: #adb5bd;
  --grey-600: #868e96;
  --grey-700: #495057;
  --grey-800: #343a40;
  --grey-900: #212529;
  --accent:   #1971c2;
  --accent-light: #e7f5ff;
  --green:    #2f9e44;
  --green-bg: #ebfbee;
  --red:      #c92a2a;
  --red-bg:   #fff5f5;
  --radius:   12px;
  --radius-sm: 8px;
  --shadow:   0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
}

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--grey-50);
  color: var(--grey-900);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  overflow-y: hidden;
}

/* ─── HEADER ─────────────────────────────────────────────────────────────── */
#app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px 10px;
  background: var(--white);
  border-bottom: 1px solid var(--grey-200);
}

#app-logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

#step-indicator {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--grey-500);
}

/* ─── PROGRESS BAR ───────────────────────────────────────────────────────── */
#progress-bar-wrap {
  height: 3px;
  background: var(--grey-200);
}
#progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s ease;
  width: 0%;
}

/* ─── CANVAS ─────────────────────────────────────────────────────────────── */
#reset-zoom-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 10;
  background: rgba(255,255,255,0.92);
  border: 1.5px solid #dee2e6;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  color: #495057;
  font-weight: 700;
  line-height: 1;
}
#reset-zoom-btn:active { background: #e9ecef; }

/* ─── CANVAS FIX ─── */
#canvas-wrap {
  flex: 1 1 auto;
  min-height: 200px;
  position: relative;
  overflow: hidden;
  touch-action: none; /* prevent browser zoom/scroll on canvas */
}
#drawing-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#drawing-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ─── STEP PANELS ────────────────────────────────────────────────────────── */
.step-panel {
  display: none;
  padding: 16px 20px 16px;
  animation: fadeUp 0.25s ease;
}

.step-panel.active {
  display: flex;
  flex-direction: column;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--grey-900);
  margin-bottom: 4px;
}

.step-hint {
  font-size: 0.85rem;
  color: var(--grey-600);
  margin-bottom: 18px;
}


/* ─── DERIVED / CALCULATED FIELDS ─── */
.input-col.derived label {
  color: #868e96;
}
.input-col.derived input,
.input-col.derived select {
  background: #f1f3f5;
  color: #495057;
  cursor: default;
}
.input-col.derived input:focus,
.input-col.derived select:focus {
  outline: none;
  border-color: #dee2e6;
}

/* ─── DERIVED NOTE ─── */
#derived-hueco-note {
  margin-top: 10px;
  padding: 8px 12px;
  background: #e7f5ff;
  border-radius: 8px;
  font-size: 13px;
  color: #1971c2;
  font-weight: 500;
}

/* ─── VERIFY NOTE ─── */
.verify-note {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fff3bf;
  border-radius: 8px;
  font-size: 13px;
  color: #e67700;
  font-weight: 500;
}

/* ─── INPUTS ─────────────────────────────────────────────────────────────── */
.input-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.input-col {
  flex: 1;
  background: var(--white);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  box-shadow: var(--shadow);
}

.input-col label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--grey-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.fraction-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fraction-row input[type="number"] {
  width: 72px;
  padding: 10px 8px;
  border: 1px solid var(--grey-300);
  border-radius: 6px;
  font-size: 1.6rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--grey-900);
  background: var(--grey-50);
  -moz-appearance: textfield;
  text-align: center;
  flex-shrink: 0;
}

.fraction-row input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--white);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.fraction-row input::-webkit-outer-spin-button,
.fraction-row input::-webkit-inner-spin-button { -webkit-appearance: none; }

.frac-select {
  width: 70px;
  flex: 0 0 70px;
  padding: 4px 2px;
  border: 1px solid var(--grey-300);
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: inherit;
  background: var(--grey-50);
  color: var(--grey-700);
  cursor: pointer;
}

.frac-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.unit {
  font-size: 0.9rem;
  color: var(--grey-500);
  font-weight: 500;
}

/* ─── DESNIVEL PILL ──────────────────────────────────────────────────────── */
.desnivel-pill {
  display: inline-block;
  background: var(--grey-100);
  border: 1px solid var(--grey-300);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--grey-700);
  margin-bottom: 18px;
  transition: all 0.2s ease;
}

.desnivel-pill.has-value {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */
.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn-primary {
  flex: 1;
  padding: 13px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-primary:active { transform: scale(0.98); background: #1864ab; }

.btn-secondary {
  padding: 13px 16px;
  background: var(--white);
  color: var(--grey-700);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-secondary:active { background: var(--grey-100); }

/* Step 0 single button */
#step-0 .btn-primary { width: 100%; margin-top: 4px; }

/* ─── SUMMARY ────────────────────────────────────────────────────────────── */
.summary-grid {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--grey-100);
}

.summary-row:last-child { border-bottom: none; }

.summary-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--grey-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-val {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--grey-900);
}

/* ─── VALIDATION BLOCK ───────────────────────────────────────────────────── */
#validation-block {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.6;
  transition: all 0.2s ease;
}

#validation-block.val-ok {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid #b2f2bb;
}

#validation-block.val-warn {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid #ffc9c9;
  animation: warn-pulse 1.6s ease-in-out infinite;
}

@keyframes warn-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}

/* ─── NOTAS ──────────────────────────────────────────────────────────────── */
.notas-block {
  margin-bottom: 16px;
}

.notas-block label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--grey-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.notas-block textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--grey-900);
  background: var(--white);
  resize: vertical;
  min-height: 72px;
}

.notas-block textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ─── SHARE ──────────────────────────────────────────────────────────────── */
.share-block {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.share-block.hidden { display: none; }

.btn-share {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn-share:active { opacity: 0.8; }
.btn-share.whatsapp { background: #25d366; color: white; }
.btn-share.sms      { background: var(--grey-700); color: white; }

/* ─── APP SHELL ──────────────────────────────────────────────────────────── */
#app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

#bottom-panel {
  flex-shrink: 0;
  background: var(--white);
  border-top: 1px solid var(--grey-200);
  overflow-y: auto;
  max-height: 55vh;
}
