/* ============================================================
   Clarity Wellness - hoja de estilos principal
   Paleta: hueso #FAF9F6 / texto #2C3E50 / menta #A8D5BA / beige #E8D5B7
   ============================================================ */

:root {
  --bg: #FAF9F6;
  --ink: #2C3E50;
  --ink-soft: #6B7A88;
  --mint: #A8D5BA;
  --mint-deep: #7FBF9A;
  --beige: #E8D5B7;
  --card: #FFFFFF;
  --line: #ECE9E2;
  --danger: #C0655B;
  --radius: 18px;
  --radius-lg: 26px;
  --shadow: 0 6px 20px rgba(44, 62, 80, 0.06);
  --shadow-soft: 0 2px 10px rgba(44, 62, 80, 0.05);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html, body { height: 100%; width: 100%; max-width: 100%; overflow-x: hidden; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 18px 96px;
  position: relative;
}

/* ---------- Ruteo de pantallas ---------- */
.screen { display: none; animation: fade 0.35s var(--ease); }
.screen.is-visible { display: block; }
.hidden { display: none !important; }

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

/* ---------- Tipografía ---------- */
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; font-weight: 700; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }
.centered { text-align: center; }
.section-label {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-soft); margin-bottom: 10px;
}

/* ---------- Tarjetas ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-center { text-align: center; }

/* ---------- Botones ---------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: none; border-radius: 999px;
  min-height: 52px; padding: 0 22px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease), opacity 0.2s;
  color: var(--ink);
}
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--mint-deep); color: #10261B;
  box-shadow: 0 4px 14px rgba(127, 191, 154, 0.4);
}
.btn-primary:hover { background: var(--mint); }

.btn-ghost {
  background: transparent; border: 1.5px solid var(--line); color: var(--ink);
}
.btn-ghost:hover { background: #F3F1EB; }

.btn-link {
  background: none; min-height: 44px; color: var(--mint-deep);
  text-decoration: none; font-weight: 600; width: 100%;
}
.btn-link.danger { color: var(--danger); }

.btn-icon {
  min-height: 44px; min-width: 44px; padding: 0;
  background: var(--card); border: 1px solid var(--line);
  font-size: 1.3rem; color: var(--ink);
}

/* ---------- Onboarding ---------- */
.onboarding { min-height: 82vh; display: flex; flex-direction: column; justify-content: center; }
.carousel { position: relative; min-height: 340px; }
.slide {
  display: none; text-align: center; padding: 12px;
  animation: fade 0.4s var(--ease);
}
.slide.is-active { display: block; }
.slide-icon { font-size: 4.5rem; margin-bottom: 18px; }
.slide h2 { margin-bottom: 12px; }
.slide p { color: var(--ink-soft); font-size: 1.05rem; max-width: 320px; margin: 0 auto; }
.disclaimer-text { font-size: 0.95rem; background: #FBF3E7; border: 1px solid var(--beige);
  padding: 14px 16px; border-radius: 14px; color: #6a5636 !important; }

.dots { display: flex; gap: 8px; justify-content: center; margin: 24px 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: all 0.3s var(--ease); }
.dot.is-active { width: 22px; border-radius: 999px; background: var(--mint-deep); }

.onboarding-actions { display: flex; gap: 12px; }
.onboarding-actions .btn { flex: 1; }

/* ---------- Auth ---------- */
.auth { margin-top: 24px; }
.brand { text-align: center; margin-bottom: 22px; }
.brand-mark {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: 1.9rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 14px;
}
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--ink-soft); }
.input, .field input, .textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: #FBFAF7; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 14px 16px; min-height: 52px; transition: border 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.textarea { min-height: auto; resize: vertical; line-height: 1.55; }
.input:focus, .field input:focus, .textarea:focus {
  outline: none; border-color: var(--mint-deep); box-shadow: 0 0 0 3px rgba(127, 191, 154, 0.2);
}
.form-error { color: var(--danger); font-size: 0.88rem; margin-bottom: 12px; }

/* ---------- Header de app ---------- */
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.app-header h1 { flex: 1; }
.app-header .spacer { width: 44px; }

.streak-pill {
  display: flex; align-items: center; gap: 6px;
  background: #FBF3E7; border: 1px solid var(--beige);
  padding: 8px 14px; border-radius: 999px; font-weight: 700;
}
.streak-flame { font-size: 1.1rem; }

/* ---------- Dashboard hero ---------- */
.card-hero { background: linear-gradient(160deg, #FFFFFF 0%, #F4FAF6 100%); }
.hero-mood { display: flex; align-items: center; gap: 16px; margin: 10px 0 16px; }
.hero-emoji { font-size: 3.2rem; }
.hero-mood-label { font-size: 1.15rem; font-weight: 700; }
.quote {
  font-style: italic; color: var(--ink); background: #F4FAF6;
  border-left: 3px solid var(--mint-deep); padding: 12px 16px;
  border-radius: 10px; margin-bottom: 18px;
}

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  font: inherit; font-weight: 600; color: var(--ink); cursor: pointer;
  box-shadow: var(--shadow-soft); transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.quick-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.quick-card:active { transform: scale(0.97); }
.quick-icon { font-size: 1.8rem; }

/* ---------- Check-in ---------- */
.mood-value { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 8px 0 18px; }
.mood-big-emoji { font-size: 4rem; transition: transform 0.2s var(--ease); }
.mood-number { font-size: 1.4rem; font-weight: 700; color: var(--mint-deep); }
.mood-label-big { font-size: 1.15rem; font-weight: 700; color: var(--mint-deep); }

/* Selector de animo de 5 niveles (emojis) */
.mood-scale { display: flex; justify-content: space-between; gap: 8px; margin: 6px 0 4px; }
.mood-opt {
  flex: 1; aspect-ratio: 1; min-height: 52px; border: 2px solid var(--line);
  background: #FBFAF7; border-radius: 16px; font-size: 1.7rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
  transition: transform 0.15s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
  filter: grayscale(0.55); opacity: 0.7;
}
.mood-opt:hover { transform: translateY(-2px); }
.mood-opt.is-active {
  border-color: var(--mint-deep); background: #F0F8F3;
  filter: grayscale(0); opacity: 1; transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(127, 191, 154, 0.35);
}
.range { width: 100%; -webkit-appearance: none; appearance: none; height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, var(--beige), var(--mint)); outline: none; }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 30px; height: 30px; border-radius: 50%;
  background: #fff; border: 3px solid var(--mint-deep); box-shadow: var(--shadow); cursor: pointer;
}
.range::-moz-range-thumb {
  width: 30px; height: 30px; border-radius: 50%; background: #fff;
  border: 3px solid var(--mint-deep); box-shadow: var(--shadow); cursor: pointer;
}
.range-legend { display: flex; justify-content: space-between; margin-top: 8px; font-size: 0.8rem; color: var(--ink-soft); }
.prompt-text { font-size: 1.05rem; font-weight: 600; margin-bottom: 12px; }
.success-mark {
  width: 64px; height: 64px; border-radius: 50%; background: var(--mint);
  color: #10261B; font-size: 2rem; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.summary-mood { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 16px 0; }
.reframe-box {
  background: #F0F8F3; border: 1px solid var(--mint); border-radius: 14px;
  padding: 14px 16px; margin: 4px 0 18px; text-align: left;
}
.reframe-box p:last-child { color: var(--ink); font-size: 0.98rem; }

/* ---------- Listas (journal / habits) ---------- */
.list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.list-item {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-soft);
}
.list-item h3 { font-size: 1.05rem; margin-bottom: 4px; }
.list-item .entry-date { font-size: 0.78rem; color: var(--ink-soft); margin-bottom: 6px; }
.list-item p { color: var(--ink-soft); font-size: 0.95rem; }
.list-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.btn-delete {
  background: none; border: none; cursor: pointer; color: var(--danger);
  font-size: 1.2rem; line-height: 1; padding: 4px 6px; border-radius: 8px; flex-shrink: 0;
}
.btn-delete:hover { background: #FBEEEC; }
.row-actions { display: flex; gap: 12px; margin-top: 14px; }
.row-actions .btn { flex: 1; }
.empty-state { text-align: center; color: var(--ink-soft); padding: 40px 20px; }

/* ---------- Aviso de modo vista previa (offline) ---------- */
.offline-note {
  background: #FBF3E7; border: 1px solid var(--beige); color: #6a5636;
  padding: 10px 14px; border-radius: 12px; font-size: 0.85rem; margin-bottom: 14px;
}

/* ---------- Hábitos ---------- */
.habit-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-soft); cursor: pointer;
  transition: background 0.2s var(--ease);
}
.habit-item.done { background: #F4FAF6; border-color: var(--mint); }
.habit-check {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 0.9rem; color: #fff; transition: all 0.2s var(--ease);
}
.habit-item.done .habit-check { background: var(--mint-deep); border-color: var(--mint-deep); }
.habit-info { flex: 1; }
.habit-info h3 { font-size: 1rem; }
.habit-streak { font-size: 0.8rem; color: var(--ink-soft); }
.habit-emoji { font-size: 1.5rem; }

.mini-calendar { display: flex; gap: 8px; justify-content: space-between; margin: 12px 0; }
.cal-cell { flex: 1; text-align: center; }
.cal-dot {
  width: 30px; height: 30px; border-radius: 10px; margin: 0 auto 4px;
  background: var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; color: var(--ink-soft);
}
.cal-dot.active { background: var(--mint); color: #10261B; font-weight: 700; }
.cal-label { font-size: 0.68rem; color: var(--ink-soft); }

/* ---------- Progreso ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart-legend { text-align: center; margin-top: 8px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stats-grid .stat { text-align: center; padding: 16px 8px; margin-bottom: 0; }
.stat-num { font-size: 1.6rem; font-weight: 700; color: var(--mint-deep); }

/* ---------- Perfil ---------- */
.profile-head { display: flex; align-items: center; gap: 16px; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%; background: var(--beige);
  color: var(--ink); font-size: 1.5rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.setting-title { font-weight: 600; }
.badge {
  background: var(--line); color: var(--ink-soft); font-size: 0.72rem; font-weight: 700;
  padding: 5px 10px; border-radius: 999px; letter-spacing: 0.05em;
}
.badge.premium { background: var(--beige); color: #6a5636; }
.disclaimer-card { background: #FBF3E7; border-color: var(--beige); }

/* ---------- Switch ---------- */
.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: var(--line); border-radius: 999px;
  transition: 0.3s var(--ease); cursor: pointer;
}
.slider::before {
  content: ''; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: 0.3s var(--ease); box-shadow: var(--shadow-soft);
}
.switch input:checked + .slider { background: var(--mint-deep); }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px; display: flex; justify-content: space-around;
  background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  z-index: 50;
}
.nav-item {
  flex: 1; background: none; border: none; cursor: pointer; color: var(--ink-soft);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 0.68rem; font-weight: 600; padding: 6px 2px; min-height: 52px;
  transition: color 0.2s var(--ease);
}
.nav-item.is-active { color: var(--mint-deep); }
.nav-ico { font-size: 1.3rem; }
.nav-center .nav-ico {
  background: var(--mint-deep); color: #10261B; width: 46px; height: 46px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin-top: -18px; box-shadow: 0 4px 14px rgba(127, 191, 154, 0.5); font-size: 1.6rem;
}

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
  #app { max-width: 460px; padding-left: 24px; padding-right: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
