/* ============================================================
   UNITECO · SISTEMA DE DISEÑO
   Paleta, tipografía, componentes base
   ============================================================ */

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

/* ── TOKENS ──────────────────────────────────────── */
:root {
  /* Paleta primaria */
  --color-primary:       #0F6B5E;
  --color-primary-light: #16A085;
  --color-primary-pale:  #E8F5F2;

  /* Neutros */
  --color-bg:            #F8F9FA;
  --color-surface:       #FFFFFF;
  --color-border:        #E9ECEF;
  --color-text-muted:    #6C757D;
  --color-text:          #1A2332;

  /* Acentos */
  --color-mir:           #E76F51;
  --color-gold:          #C9A961;
  --color-gold-pale:     #FBF6EC;
  --color-alert:         #F4A261;
  --color-success:       #2A9D8F;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(26,35,50,.06), 0 1px 2px rgba(26,35,50,.04);
  --shadow-md: 0 4px 12px rgba(26,35,50,.08), 0 2px 4px rgba(26,35,50,.04);
  --shadow-lg: 0 8px 24px rgba(26,35,50,.12);

  /* Radios */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-pill: 100px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 20px;
  --space-xl: 24px;
  --space-2xl: 32px;

  /* Tipografía */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 700;
  --font-semibold: 600;
  --font-medium: 500;
  --font-regular: 400;

  /* Transiciones */
  --transition-fast: 150ms ease;
  --transition: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ── RESET BÁSICO ────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html { font-size: 16px; }

body {
  font-family: var(--font-family);
  font-size: 16px;
  color: var(--color-text);
  background: #D0D5DD;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── MARCO DE MÓVIL (gestionado desde index.html) ── */
/* Los estilos del frame se definen en el <style> del index
   para que el modo escritorio pueda sobreescribirlos */

/* Status bar simulada */
.status-bar {
  height: 44px;
  padding: 12px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

.status-bar .time { font-weight: 700; }
.status-bar .icons { display: flex; gap: 4px; align-items: center; }

/* Scroll interior */
.phone-screen {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  scroll-behavior: smooth;
}

.phone-screen::-webkit-scrollbar { display: none; }
.phone-screen { -ms-overflow-style: none; scrollbar-width: none; }

/* ── COMPONENTES BASE ─────────────────────────────── */

/* Card */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  border: 1px solid rgba(0,0,0,.04);
}

.card-elevated {
  box-shadow: var(--shadow-md);
}

/* CTA primario */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  background: var(--color-primary-light);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.btn-primary:hover { background: var(--color-primary); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }

/* CTA secundario */
.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-secondary:hover { background: var(--color-primary-pale); }

/* CTA ghost */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  color: var(--color-primary-light);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-ghost:hover { background: var(--color-primary-pale); }

/* Chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.chip-primary { background: var(--color-primary-pale); color: var(--color-primary); }
.chip-gold { background: var(--color-gold-pale); color: #8B6914; }
.chip-plata { background: #F0F0F4; color: #5A6480; }
.chip-mir { background: #FDF0EC; color: #C1532A; }
.chip-success { background: #E8F5F2; color: #1A7A70; }
.chip-alert { background: #FEF4EC; color: #B25E00; }
.chip-outline { background: transparent; border: 1px solid var(--color-border); color: var(--color-text-muted); }

/* Chip seleccionable (onboarding) */
.chip-toggle {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  transition: var(--transition);
  user-select: none;
}
.chip-toggle:hover { border-color: var(--color-primary-light); color: var(--color-primary); }
.chip-toggle.selected {
  background: var(--color-primary-pale);
  border-color: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
}

/* Avatar */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary-pale);
  color: var(--color-primary);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar-gold { background: var(--color-gold-pale); color: #8B6914; }
.avatar-mir { background: #FDF0EC; color: #C1532A; }

/* Banner explicativo */
.explain-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--color-text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-family);
  padding: 4px 0;
  transition: var(--transition);
}
.explain-trigger:hover { color: var(--color-primary); }
.explain-trigger svg { width: 14px; height: 14px; }

.explain-content {
  background: #F0F7F5;
  border-left: 3px solid var(--color-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-top: 8px;
  display: none;
}
.explain-content.open { display: block; animation: slideDown 200ms ease; }

/* ── BOTTOM NAV ──────────────────────────────────── */
.bottom-nav {
  display: flex;
  align-items: stretch;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 8px 4px 16px;
  gap: 0;
  flex-shrink: 0;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  background: none;
  border: none;
  font-family: var(--font-family);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 500;
}
.nav-item:hover { color: var(--color-primary); }
.nav-item.active { color: var(--color-primary); }
.nav-item.active svg { stroke: var(--color-primary); }
.nav-item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.nav-item.active svg { stroke-width: 2.2; }

/* ── SKELETON LOADER ─────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #E9ECEF 25%, #F8F9FA 50%, #E9ECEF 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── SWITCH ──────────────────────────────────────── */
.switch-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.switch-wrap:last-child { border-bottom: none; }
.switch-label { font-size: 15px; color: var(--color-text); font-weight: 500; }
.switch-sub { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }

.switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.switch input { display: none; }
.switch-track {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition);
}
.switch input:checked + .switch-track { background: var(--color-primary-light); }
.switch-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .switch-track::after { transform: translateX(18px); }

/* ── HEADER DE PANTALLA ──────────────────────────── */
.screen-header {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  background: rgba(248,249,250,.92);
  backdrop-filter: blur(8px);
  z-index: 20;
  border-bottom: 1px solid rgba(0,0,0,.04);
}
.screen-header h2 { font-size: 17px; font-weight: 600; flex: 1; }
.back-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-border);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  color: var(--color-text);
  flex-shrink: 0;
  transition: var(--transition);
}
.back-btn:hover { background: var(--color-primary-pale); color: var(--color-primary); }

/* ── BARRA DE PROGRESO ───────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
  border-radius: var(--radius-pill);
  transition: width 600ms ease;
}

/* ── ANIMACIONES ─────────────────────────────────── */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.92); }
  60% { transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes checkmark {
  0% { stroke-dashoffset: 50; }
  100% { stroke-dashoffset: 0; }
}

/* Confetti (solo en primer onboarding completado) */
@keyframes confetti-fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(400px) rotate(720deg); opacity: 0; }
}

.screen-enter { animation: slideUp 250ms ease; }
.screen-fade { animation: fadeIn 200ms ease; }

/* ── MODAL ───────────────────────────────────────── */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26,35,50,.4);
  backdrop-filter: blur(2px);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-sheet {
  background: var(--color-surface);
  border-radius: 24px 24px 0 0;
  width: 100%;
  padding: 12px 20px 32px;
  transform: translateY(20px);
  transition: transform 250ms ease;
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-pill);
  margin: 0 auto 20px;
}

/* ── HORARIO SELECTOR ────────────────────────────── */
.time-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 10px;
}
.time-slot:hover { border-color: var(--color-primary-light); background: var(--color-primary-pale); }
.time-slot.selected { border-color: var(--color-primary-light); background: var(--color-primary-pale); }
.time-slot .slot-dia { font-size: 14px; font-weight: 600; }
.time-slot .slot-hora { font-size: 13px; color: var(--color-text-muted); }
.time-slot .slot-modo { margin-left: auto; font-size: 12px; color: var(--color-primary); font-weight: 500; }

/* ── CARRUSEL ────────────────────────────────────── */
.carousel-wrap {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 20px 8px;
  margin: 0 -20px;
  scrollbar-width: none;
}
.carousel-wrap::-webkit-scrollbar { display: none; }

.carousel-card {
  min-width: 220px;
  max-width: 220px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid rgba(0,0,0,.04);
  box-shadow: var(--shadow-sm);
  scroll-snap-align: start;
  flex-shrink: 0;
  cursor: pointer;
  transition: var(--transition);
}
.carousel-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.carousel-card .card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.carousel-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; line-height: 1.3; }
.carousel-card p { font-size: 12px; color: var(--color-text-muted); line-height: 1.4; margin-bottom: 12px; }
.carousel-card .card-cta {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary-light);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── CHECK ANIMADO ───────────────────────────────── */
.check-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-success);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: popIn 400ms ease;
  margin: 0 auto;
}
.check-circle svg {
  width: 32px;
  height: 32px;
  stroke: white;
  fill: none;
  stroke-width: 3;
  stroke-dasharray: 50;
  stroke-dashoffset: 0;
  animation: checkmark 400ms 200ms ease both;
}

/* ── TYPING INDICATOR ────────────────────────────── */
.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 14px;
}
.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--color-text-muted);
  border-radius: 50%;
  animation: typingBounce 1.2s ease infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ── BOCADILLO CHAT ──────────────────────────────── */
.bubble {
  max-width: 80%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 4px;
}
.bubble-in {
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 16px 16px 16px 4px;
  align-self: flex-start;
  box-shadow: var(--shadow-sm);
}
.bubble-out {
  background: var(--color-primary-light);
  color: white;
  border-radius: 16px 16px 4px 16px;
  align-self: flex-end;
}

/* ── CONFETTI ────────────────────────────────────── */
.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confetti-fall 2s ease-in forwards;
  top: -10px;
}

/* ── MODO PRESENTACIÓN ───────────────────────────── */
body.presentation-mode * { cursor: none !important; }
.presentation-cursor {
  position: fixed;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(22, 160, 133, 0.7);
  border: 2px solid var(--color-primary-light);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform 50ms;
}
.presentation-cursor.click {
  transform: translate(-50%, -50%) scale(1.6);
  background: rgba(22, 160, 133, 0.4);
}

body.presentation-mode .btn-primary:hover,
body.presentation-mode .btn-secondary:hover,
body.presentation-mode .carousel-card:hover {
  outline: 3px solid var(--color-primary-light);
  outline-offset: 2px;
}

/* ── CHROME DE PRESENTACIÓN ──────────────────────── */
.presentation-chrome {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.chrome-controls {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.chrome-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(26,35,50,.85);
  color: white;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-family);
  border: 1px solid rgba(255,255,255,.12);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: var(--transition);
  white-space: nowrap;
}
.chrome-btn:hover { background: rgba(26,35,50,.95); }
.chrome-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* Selector de arquetipo */
.archetype-selector {
  position: fixed;
  top: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.archetype-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,.5);
  padding: 0 4px;
}

.archetype-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(26,35,50,.75);
  color: rgba(255,255,255,.7);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-family);
  border: 1.5px solid rgba(255,255,255,.1);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: var(--transition);
}
.archetype-btn:hover { background: rgba(26,35,50,.9); color: white; }
.archetype-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary-light);
}

.archetype-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Flujos rápidos */
.flows-panel {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 200;
}

.flow-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: rgba(26,35,50,.75);
  color: rgba(255,255,255,.7);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-family);
  border: 1px solid rgba(255,255,255,.08);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: var(--transition);
}
.flow-btn:hover { background: rgba(26,35,50,.9); color: white; }
.flow-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,.4); padding: 0 4px; }

/* ── UTILIDADES ──────────────────────────────────── */
.text-muted { color: var(--color-text-muted); }
.text-primary { color: var(--color-primary); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 22px; }
.text-2xl { font-size: 28px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.mt-xs { margin-top: 4px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 20px; }
.mt-xl { margin-top: 24px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 20px; }
.p-screen { padding: 0 20px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* ── RESPONSIVE (fallback) ───────────────────────── */
@media (max-width: 440px) {
  .chrome-controls, .archetype-selector, .flows-panel { display: none; }
}
