/* =====================================================================
   Cana Health — Global Stylesheet
   Design system tokens + utility classes used across all pages.
   ===================================================================== */

:root {
  --bg: #FAF7F2;
  --bg-elev: #ffffff;
  --bg-soft: #f3ede2;
  --ink: #0A1814;
  --ink-muted: #4a5752;
  --ink-soft: #6b766f;
  --line: #e7e0d2;
  --line-strong: #d8cfbd;
  --brand: #0F4C3A;
  --brand-dark: #0a3a2c;
  --brand-soft: #dcecdf;
  --accent: #D4A24C;
  --accent-soft: #faedcc;
  --danger: #b04848;
  --success: #3c8050;
}
.dark {
  --bg: #0A1814;
  --bg-elev: #11221d;
  --bg-soft: #15302a;
  --ink: #f0f7f3;
  --ink-muted: #b9c8c1;
  --ink-soft: #8da199;
  --line: #1d3830;
  --line-strong: #2a4d42;
  --brand: #5b9c6c;
  --brand-dark: #3c8050;
  --brand-soft: #15302a;
  --accent: #e8a534;
  --accent-soft: #2a2014;
  --danger: #d97070;
  --success: #5b9c6c;
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; box-sizing: border-box; }
html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', sans-serif;
  transition: background-color .35s ease, color .35s ease;
  margin: 0;
  padding: 0;
}

.font-display { font-family: 'Fraunces', serif; font-feature-settings: "ss01" 1; }

/* Subtle paper-grain texture */
.grain { position: relative; }
.grain::after {
  content: "";
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .03;
  pointer-events: none;
  mix-blend-mode: multiply;
  z-index: 0;
}
.dark .grain::after { mix-blend-mode: screen; opacity: .05; }
.grain > * { position: relative; z-index: 1; }

/* Surfaces */
.surface { background: var(--bg-elev); border: 1px solid var(--line); }
.surface-soft { background: var(--bg-soft); border: 1px solid var(--line); }

/* Text colors */
.ink-muted { color: var(--ink-muted); }
.ink-soft { color: var(--ink-soft); }
.brand-text { color: var(--brand); }
.accent-text { color: var(--accent); }
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .75rem 1.25rem; border-radius: 999px;
  font-weight: 600; font-size: .9rem;
  transition: all .25s ease;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: .5rem 1rem; font-size: .8rem; }
.btn-lg { padding: .9rem 1.5rem; font-size: 1rem; }

.btn-primary { background: var(--brand); color: #FAF7F2; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 8px 24px -8px rgba(15,76,58,.45); }
.dark .btn-primary { color: #0A1814; }

.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-soft); }

.btn-accent { background: var(--accent); color: #2a2014; }
.btn-accent:hover { background: #c89238; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.9); }

.btn-block { width: 100%; }

/* Form inputs */
.input, .textarea, .select {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  border-radius: 14px;
  padding: .75rem 1rem;
  font-family: inherit;
  font-size: .9rem;
  transition: all .2s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-soft); }

.label {
  display: block; font-size: .8rem; font-weight: 600;
  color: var(--ink-muted); margin-bottom: .35rem;
  text-transform: uppercase; letter-spacing: .04em;
}

/* Chip / badge */
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .65rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; letter-spacing: .02em;
}

/* Tab pills */
.tab {
  padding: .55rem 1rem; border-radius: 999px;
  font-size: .85rem; font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all .2s;
  background: transparent;
  border: none;
}
.tab.active { background: var(--brand); color: #FAF7F2; }
.dark .tab.active { color: #0A1814; }

/* Pulse dot animation */
@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: .5; }
}
.pulse-dot { animation: pulseDot 1.6s ease-in-out infinite; }

/* Card glow */
.glow {
  background: radial-gradient(120% 80% at 0% 0%, rgba(212,162,76,.18), transparent 50%),
              radial-gradient(120% 80% at 100% 100%, rgba(15,76,58,.18), transparent 50%);
}
.dark .glow {
  background: radial-gradient(120% 80% at 0% 0%, rgba(232,165,52,.18), transparent 50%),
              radial-gradient(120% 80% at 100% 100%, rgba(91,156,108,.22), transparent 50%);
}

/* Reveal animation */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.reveal { animation: fadeUp .5s ease-out both; }

/* Avatar */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-weight: 700;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #FAF7F2;
}

/* Bar chart */
.bar { background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%); border-radius: 4px 4px 0 0; }
.dark .bar { background: linear-gradient(180deg, #76b687 0%, var(--brand) 100%); }

/* Animated nav underline (used on landing) */
.nav-link { position: relative; }
.nav-link::after {
  content: ""; position: absolute; bottom: -4px; left: 0;
  height: 2px; width: 0; background: var(--brand);
  transition: width .25s ease;
}
.nav-link:hover::after { width: 100%; }
.dark .nav-link::after { background: var(--accent); }

/* Stat card */
.stat-card { padding: 1.25rem; border-radius: 24px; background: var(--bg-elev); border: 1px solid var(--line); position: relative; overflow: hidden; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }

/* Phone frame (used on landing) */
.phone {
  width: 280px;
  border-radius: 38px;
  background: var(--ink);
  padding: 8px;
  box-shadow: 0 40px 80px -20px rgba(10,24,20,.4);
  position: relative;
}
.phone-screen {
  border-radius: 30px;
  overflow: hidden;
  background: var(--bg);
  height: 560px;
  position: relative;
}
.phone::before {
  content:""; position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  width: 90px; height: 22px; background: #000; border-radius: 14px; z-index: 5;
}

/* Mobile responsive tweaks */
@media (max-width: 768px) {
  .phone { width: 240px; }
  .phone-screen { height: 480px; }
}

/* Hide on mobile / tablet */
@media (max-width: 1023px) {
  .lg\:block { display: none; }
}
