/* ============================================================
   Thamdoimass NoseCare — Shared Design System
   Surgical Teal × Champagne Gold
   ============================================================ */

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

:root {
  --primary-900: #0A2E33;
  --primary-700: #0F4C5C;
  --primary-500: #1B7A8A;
  --primary-300: #5BA8B5;
  --primary-100: #D6EAEE;
  --gold-900: #8B6F3D;
  --gold-700: #B58A4F;
  --gold-500: #D4A574;
  --gold-300: #E8C9A0;
  --gold-100: #F8EFE0;
  --coral-500: #E89A8C;
  --coral-300: #F5C5BC;
  --pearl: #FAF7F2;
  --cream: #F4EFE8;
  --white: #FFFFFF;
  --charcoal: #1F2937;
  --slate-700: #334155;
  --slate-500: #64748B;
  --slate-300: #CBD5E1;
  --slate-100: #F1F5F9;
  --success: #2D8A6E;
  --warning: #D97706;
  --danger: #B91C1C;
  --max-width: 1200px;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Kanit', system-ui, -apple-system, sans-serif;
  background: var(--pearl);
  color: var(--charcoal);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  font-weight: 400;
}
.display, h1, h2, h3, h4, h5, h6, .auth-title, .reading-title, .logo {
  font-family: 'Kanit', system-ui, -apple-system, sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
:lang(th), [lang="th"] { line-height: 1.65; }
h1, h2 { line-height: 1.2; font-weight: 600; }
h3, h4 { line-height: 1.35; font-weight: 600; }
strong, b { font-weight: 600; }

/* ====== NAV ====== */
nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250,247,242,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(15,76,92,0.08);
}
.nav-inner { max-width: var(--max-width); margin: 0 auto; padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; }
.logo { font-family: 'Kanit', system-ui, sans-serif; font-size: 22px; font-weight: 600; color: var(--primary-900); display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-mark { width: 32px; height: 32px; background: linear-gradient(135deg, var(--primary-700), var(--primary-500)); border-radius: 50%; position: relative; box-shadow: 0 2px 8px rgba(15,76,92,0.2); }
.logo-mark::after { content: ''; position: absolute; inset: 8px; background: linear-gradient(135deg, var(--gold-500), var(--gold-700)); border-radius: 50%; }
.logo .gold { color: var(--gold-700); margin-left: 4px; }
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-link { font-size: 14px; color: var(--slate-700); text-decoration: none; font-weight: 500; transition: color 0.2s; }
.nav-link:hover { color: var(--primary-700); }
.btn-nav { padding: 10px 20px; background: var(--primary-700); color: var(--white); border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 14px; transition: all 0.25s ease; }
.btn-nav:hover { background: var(--primary-900); transform: translateY(-1px); }
@media (max-width: 768px) { .nav-links .nav-link { display: none; } }

/* ====== BUTTONS ====== */
.btn-primary, .btn-gold, .btn-ghost, .btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px 28px; border-radius: 999px;
  text-decoration: none; font-weight: 600; font-size: 16px;
  transition: all 0.25s ease; border: none; cursor: pointer;
  font-family: inherit; min-height: 56px;
}
.btn-primary { background: var(--primary-700); color: var(--white); box-shadow: 0 8px 24px rgba(15,76,92,0.25); }
.btn-primary:hover { background: var(--primary-900); transform: translateY(-2px); box-shadow: 0 12px 32px rgba(15,76,92,0.35); }
.btn-gold { background: linear-gradient(135deg, var(--gold-500), var(--gold-700)); color: var(--white); box-shadow: 0 8px 24px rgba(180,138,79,0.3); }
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(180,138,79,0.4); }
.btn-ghost { background: transparent; color: var(--primary-700); border: 1.5px solid var(--primary-300); }
.btn-ghost:hover { background: var(--primary-100); }
.btn-outline { background: var(--white); color: var(--primary-700); border: 1.5px solid var(--slate-300); }
.btn-outline:hover { border-color: var(--primary-700); }
.btn-block { width: 100%; }

/* ====== SECTIONS ====== */
section { padding: 100px 24px; position: relative; }
.section-inner { max-width: var(--max-width); margin: 0 auto; }
.section-header { text-align: center; margin-bottom: 64px; }
.section-eyebrow { font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold-700); font-weight: 700; margin-bottom: 12px; }
.section-title { font-family: 'Kanit', system-ui, sans-serif; font-size: clamp(32px, 4vw, 44px); font-weight: 600; color: var(--primary-900); line-height: 1.2; margin-bottom: 16px; letter-spacing: -0.01em; }
.section-desc { font-size: 18px; color: var(--slate-700); max-width: 680px; margin: 0 auto; line-height: 1.65; }

/* ====== PAGE HERO (small hero for inner pages) ====== */
.page-hero { padding: 80px 24px 60px; background: linear-gradient(180deg, var(--pearl), var(--cream)); text-align: center; }
.page-hero-eyebrow { font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold-700); font-weight: 700; margin-bottom: 12px; }
.page-hero h1 { font-family: 'Kanit', system-ui, sans-serif; font-size: clamp(32px, 5vw, 52px); font-weight: 600; color: var(--primary-900); line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 16px; }
.page-hero p { font-size: 18px; color: var(--slate-700); max-width: 680px; margin: 0 auto; line-height: 1.65; }

/* ====== AUTH FORMS (Login/Signup) ====== */
.auth-page { min-height: calc(100vh - 80px); display: flex; align-items: center; justify-content: center; padding: 40px 20px; background: linear-gradient(180deg, var(--pearl) 0%, var(--cream) 100%); }
.auth-card {
  background: var(--white);
  border-radius: 28px;
  padding: 40px 32px;
  width: 100%; max-width: 440px;
  box-shadow: 0 20px 60px rgba(15,76,92,0.12);
  position: relative;
}
.auth-card::before { content: ''; position: absolute; top: -1px; left: 24px; right: 24px; height: 3px; background: linear-gradient(90deg, var(--gold-500), var(--primary-700)); border-radius: 3px; }
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-eyebrow { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-700); font-weight: 700; margin-bottom: 8px; }
.auth-title { font-family: 'Kanit', system-ui, sans-serif; font-size: 28px; font-weight: 600; color: var(--primary-900); margin-bottom: 6px; }
.auth-subtitle { font-size: 14px; color: var(--slate-500); }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--charcoal); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 14px 16px;
  border: 1.5px solid var(--slate-300);
  border-radius: 12px;
  font-size: 15px; font-family: inherit;
  background: var(--white); color: var(--charcoal);
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 52px;
}
.form-input:focus { outline: none; border-color: var(--primary-500); box-shadow: 0 0 0 3px rgba(91,168,181,0.15); }
.form-input::placeholder { color: var(--slate-300); }
.form-helper { font-size: 12px; color: var(--slate-500); margin-top: 6px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 6px; min-height: 16px; }
.form-success { font-size: 12px; color: var(--success); margin-top: 6px; }

.form-checkbox-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; }
.form-checkbox { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; cursor: pointer; accent-color: var(--primary-700); }
.form-checkbox-label { font-size: 13px; color: var(--slate-700); line-height: 1.5; cursor: pointer; }
.form-checkbox-label a { color: var(--primary-700); text-decoration: underline; }

.form-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--slate-300); font-size: 12px; }
.form-divider::before, .form-divider::after { content: ''; flex: 1; height: 1px; background: var(--slate-100); }

.social-btn {
  width: 100%; padding: 13px; border-radius: 12px;
  background: var(--white); border: 1.5px solid var(--slate-300);
  font-size: 14px; font-weight: 600; color: var(--charcoal);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer; font-family: inherit;
  transition: all 0.2s;
  margin-bottom: 8px; min-height: 48px;
}
.social-btn:hover { border-color: var(--primary-700); background: var(--pearl); }
.social-icon { width: 20px; height: 20px; flex-shrink: 0; }

.auth-footer { text-align: center; margin-top: 24px; font-size: 14px; color: var(--slate-700); }
.auth-footer a { color: var(--primary-700); font-weight: 600; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

.auth-aside { font-size: 13px; color: var(--slate-500); text-align: center; line-height: 1.5; padding: 12px; background: var(--pearl); border-radius: 10px; margin-top: 16px; }
.auth-aside a { color: var(--primary-700); }

/* Loading spinner inside button */
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-bottom-color: transparent; border-radius: 50%; display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ====== ALERT ====== */
.alert { padding: 14px 16px; border-radius: 12px; font-size: 14px; line-height: 1.5; margin-bottom: 16px; display: flex; gap: 12px; align-items: flex-start; }
.alert.error { background: rgba(185,28,28,0.08); color: var(--danger); border: 1px solid rgba(185,28,28,0.2); }
.alert.success { background: rgba(45,138,110,0.1); color: var(--success); border: 1px solid rgba(45,138,110,0.2); }
.alert.info { background: var(--primary-100); color: var(--primary-900); border: 1px solid var(--primary-300); }
.alert.warning { background: rgba(212,165,116,0.15); color: var(--gold-900); border: 1px solid var(--gold-500); }

/* ====== CONTENT (legal pages) ====== */
.content-wrap { max-width: 760px; margin: 0 auto; padding: 60px 24px 100px; }
.content-wrap h2 { font-family: 'Kanit', system-ui, sans-serif; font-size: 28px; font-weight: 600; color: var(--primary-900); margin: 40px 0 16px; }
.content-wrap h3 { font-size: 18px; font-weight: 600; color: var(--primary-900); margin: 24px 0 10px; }
.content-wrap p { font-size: 16px; color: var(--charcoal); line-height: 1.75; margin-bottom: 14px; }
.content-wrap ul, .content-wrap ol { margin: 8px 0 14px 24px; }
.content-wrap li { margin-bottom: 8px; line-height: 1.65; }
.content-wrap strong { color: var(--primary-900); }
.content-wrap a { color: var(--primary-700); }
.content-wrap table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.content-wrap th, .content-wrap td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--slate-100); font-size: 14px; }
.content-wrap th { background: var(--cream); color: var(--primary-900); font-weight: 600; }
.toc { background: var(--cream); padding: 20px 24px; border-radius: 14px; margin-bottom: 32px; }
.toc h4 { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-700); font-weight: 700; margin-bottom: 12px; }
.toc ol { margin: 0 0 0 20px; }
.toc li { margin-bottom: 4px; font-size: 14px; }
.toc a { color: var(--primary-700); text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* ====== APP DASHBOARD ====== */
.dashboard { padding: 40px 24px; max-width: var(--max-width); margin: 0 auto; }
.dashboard-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; margin-bottom: 32px; }
.dashboard-greeting h1 { font-family: 'Kanit', system-ui, sans-serif; font-size: 32px; color: var(--primary-900); }
.dashboard-greeting p { font-size: 15px; color: var(--slate-500); margin-top: 4px; }
.user-pill { display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; background: var(--white); border-radius: 999px; box-shadow: 0 2px 8px rgba(15,76,92,0.06); }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--gold-500), var(--gold-700)); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.user-info { font-size: 13px; }
.user-info strong { display: block; color: var(--charcoal); }
.user-info small { color: var(--slate-500); }

.dash-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 32px; }
.dash-card { background: var(--white); border-radius: 18px; padding: 24px; box-shadow: 0 4px 12px rgba(15,76,92,0.05); border: 1px solid rgba(15,76,92,0.04); }
.dash-card-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--primary-100); color: var(--primary-700); display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 14px; }
.dash-card-icon.gold { background: var(--gold-100); color: var(--gold-700); }
.dash-card-icon.coral { background: var(--coral-300); color: white; }
.dash-card h3 { font-size: 16px; color: var(--charcoal); margin-bottom: 6px; font-weight: 600; }
.dash-card p { font-size: 13px; color: var(--slate-500); line-height: 1.5; margin-bottom: 14px; }
.dash-card a { color: var(--primary-700); font-weight: 600; font-size: 13px; text-decoration: none; }
.dash-card a:hover { text-decoration: underline; }

.dash-cta-card { background: linear-gradient(135deg, var(--primary-900), var(--primary-700)); color: white; border-radius: 24px; padding: 32px; display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
@media (max-width: 700px) { .dash-cta-card { grid-template-columns: 1fr; } }
.dash-cta-card h2 { font-family: 'Kanit', system-ui, sans-serif; font-size: 28px; margin-bottom: 8px; }
.dash-cta-card p { font-size: 15px; color: rgba(255,255,255,0.8); margin-bottom: 0; }

/* ====== FOOTER ====== */
footer { background: var(--primary-900); color: rgba(255,255,255,0.7); padding: 60px 24px 24px; }
.footer-inner { max-width: var(--max-width); margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-col h5 { font-size: 12px; color: var(--gold-300); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; margin-bottom: 16px; }
.footer-col ul { list-style: none; }
.footer-col li { padding: 4px 0; }
.footer-col a { font-size: 14px; color: rgba(255,255,255,0.65); text-decoration: none; transition: color 0.2s; }
.footer-col a:hover { color: var(--gold-300); }
.footer-brand .logo { color: white; margin-bottom: 12px; }
.footer-brand p { font-size: 13px; color: rgba(255,255,255,0.55); line-height: 1.6; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 12px; color: rgba(255,255,255,0.5); }

/* ====== UTIL ====== */
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }
