/* =====================================================================
   Hay Fever SOS — App Design System
   Shared across all 16 pages of the member portal.
   Typefaces: DM Serif Display (headlines) + DM Sans (body/UI)
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ── Tokens ─────────────────────────────────────────────── */
:root {
    --dust:       #F5F0E8;
    --dust-dark:  #EAE3D6;
    --mist:       #D8D4CC;
    --mist-light: #E8E4DC;
    --sage:       #4A6741;
    --sage-dark:  #354C30;
    --sage-tint:  #EBF0EA;
    --amber:      #C8820A;
    --amber-tint: #FDF3E0;
    --red:        #B91C1C;
    --red-tint:   #FEF2F2;
    --ink:        #1C1C1C;
    --ink-soft:   #4A4A48;
    --ink-muted:  #7A7A76;
    --white:      #FFFFFF;
    --radius-sm:  3px;
    --radius-md:  6px;
    --radius-lg:  10px;
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    background-color: var(--dust);
    color: var(--ink);
    font-family: 'DM Sans', system-ui, sans-serif;
    font-weight: 400;
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Typography ─────────────────────────────────────────── */
h1, h2, h3 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-weight: 400;
    line-height: 1.2;
    color: var(--ink);
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: 0.75rem; }
h2 { font-size: clamp(1.25rem, 3vw, 1.75rem); margin-bottom: 0.625rem; }
h3 { font-size: 1.125rem; margin-bottom: 0.5rem; }

p { color: var(--ink-soft); line-height: 1.65; }
a { color: var(--sage); text-underline-offset: 3px; }
a:hover { color: var(--sage-dark); }

/* ── Layout ─────────────────────────────────────────────── */
.app-page    { min-height: 100vh; background: var(--dust); padding-top: 64px; }
.container   { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 640px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Navigation ─────────────────────────────────────────── */
.app-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: var(--white); border-bottom: 1px solid var(--mist);
    height: 64px; display: flex; align-items: center;
}
.app-nav-inner {
    width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 1.5rem;
    display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
    display: flex; align-items: center; gap: 0.625rem;
    text-decoration: none; color: var(--ink);
}
.nav-logo-mark {
    width: 32px; height: 32px; background: var(--sage);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
}
.nav-logo-mark svg { width: 18px; height: 18px; stroke: var(--white); }
.nav-logo-text {
    font-family: 'DM Serif Display', serif; font-size: 1.125rem;
    color: var(--ink); letter-spacing: -0.01em;
}
.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-link {
    font-size: 0.875rem; font-weight: 500; color: var(--ink-soft);
    text-decoration: none; transition: color 0.15s;
}
.nav-link:hover { color: var(--sage); }
.nav-badge {
    font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em;
    background: var(--sage); color: var(--white);
    padding: 0.2rem 0.5rem; border-radius: 100px;
}

/* ── Cards ──────────────────────────────────────────────── */
.card     { background: var(--white); border: 1px solid var(--mist); border-radius: var(--radius-md); padding: 2rem; }
.card-sm  { background: var(--white); border: 1px solid var(--mist); border-radius: var(--radius-md); padding: 1.25rem 1.5rem; }
.card-tint { background: var(--dust); border: 1px solid var(--mist-light); border-radius: var(--radius-md); padding: 1.25rem 1.5rem; }
.card-sage { background: var(--sage); border-radius: var(--radius-md); padding: 2rem; color: var(--white); }
.card-sage h1, .card-sage h2, .card-sage h3, .card-sage p { color: var(--white); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    font-family: 'DM Sans', sans-serif; font-size: 0.9375rem; font-weight: 600;
    border: none; border-radius: var(--radius-sm); padding: 0.75rem 1.5rem;
    cursor: pointer; text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
    letter-spacing: 0.01em; line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--sage); color: var(--white); }
.btn-primary:hover { background: var(--sage-dark); color: var(--white); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink-muted); border: 1px solid var(--mist); }
.btn-ghost:hover { border-color: var(--sage); color: var(--sage); }
.btn-danger { background: var(--red-tint); color: var(--red); border: 1px solid rgba(185,28,28,0.2); }
.btn-danger:hover { background: var(--red); color: var(--white); }
.btn-full { width: 100%; }
.btn-sm { font-size: 0.8125rem; padding: 0.5rem 1rem; }
.btn-lg { font-size: 1.0625rem; padding: 1rem 2rem; }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 1.125rem; }
.form-label { display: block; margin-bottom: 0.375rem; font-size: 0.875rem; font-weight: 500; color: var(--ink-soft); }

.form-input, .form-select, .form-textarea {
    width: 100%; padding: 0.75rem 0.875rem;
    border: 1.5px solid var(--mist); border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif; font-size: 0.9375rem;
    color: var(--ink); background: var(--white);
    transition: border-color 0.15s; appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--sage); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--ink-muted); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237A7A76' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.875rem center;
    padding-right: 2.5rem; cursor: pointer;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--sage); width: 1rem; height: 1rem; cursor: pointer; }

/* ── Badges ─────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; font-size: 0.75rem; font-weight: 600; padding: 0.25rem 0.625rem; border-radius: 100px; letter-spacing: 0.03em; }
.badge-sage   { background: var(--sage-tint); color: var(--sage-dark); border: 1px solid rgba(74,103,65,0.2); }
.badge-amber  { background: var(--amber-tint); color: var(--amber); border: 1px solid rgba(200,130,10,0.25); }
.badge-red    { background: var(--red-tint); color: var(--red); border: 1px solid rgba(185,28,28,0.2); }

/* ── Alerts ─────────────────────────────────────────────── */
.alert { padding: 0.875rem 1.125rem; border-radius: var(--radius-sm); font-size: 0.875rem; line-height: 1.55; margin-bottom: 1rem; }
.alert-error   { background: var(--red-tint);   border-left: 3px solid var(--red);   color: var(--red); }
.alert-warning { background: var(--amber-tint); border-left: 3px solid var(--amber); color: var(--amber); }
.alert-success { background: var(--sage-tint);  border-left: 3px solid var(--sage);  color: var(--sage-dark); }
.alert-info    { background: var(--dust-dark);  border-left: 3px solid var(--mist);  color: var(--ink-soft); }

/* ── Divider ────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--mist); margin: 1.5rem 0; }

/* ── Skeleton ───────────────────────────────────────────── */
@keyframes skeleton-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.skeleton { background: var(--mist-light); border-radius: var(--radius-sm); animation: skeleton-pulse 1.8s ease-in-out infinite; }

/* ── Auth pages ─────────────────────────────────────────── */
.auth-page {
    min-height: 100vh; background: var(--sage);
    display: flex; align-items: center; justify-content: center;
    padding: 2rem 1.5rem;
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo a { display: inline-flex; align-items: center; gap: 0.625rem; text-decoration: none; color: var(--white); }
.auth-logo-text { font-family: 'DM Serif Display', serif; font-size: 1.25rem; color: var(--white); }
.auth-card { background: var(--white); border-radius: var(--radius-md); padding: 2.5rem 2rem; width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.625rem; margin-bottom: 0.25rem; }
.auth-subtitle { font-size: 0.875rem; color: var(--ink-muted); margin-bottom: 1.75rem; }
.auth-footer { text-align: center; font-size: 0.75rem; color: rgba(255,255,255,0.6); margin-top: 1.5rem; padding: 0 1rem; }

/* ── Module cards ───────────────────────────────────────── */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.module-card {
    background: var(--white); border: 1px solid var(--mist);
    border-radius: var(--radius-md); padding: 1.5rem;
    text-decoration: none; color: var(--ink);
    display: flex; flex-direction: column; gap: 0.75rem;
    transition: border-color 0.15s, box-shadow 0.15s; cursor: pointer;
}
.module-card:hover { border-color: var(--sage); box-shadow: 0 4px 16px rgba(74,103,65,0.1); text-decoration: none; color: var(--ink); }
.module-card.locked { opacity: 0.55; cursor: default; pointer-events: none; }
.module-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--sage-tint); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.module-title { font-family: 'DM Serif Display', serif; font-size: 1.0625rem; color: var(--ink); line-height: 1.3; margin: 0; }
.module-desc  { font-size: 0.875rem; color: var(--ink-muted); line-height: 1.55; margin: 0; }

/* ── Page header ────────────────────────────────────────── */
.page-header { padding: 2.5rem 0 2rem; border-bottom: 1px solid var(--mist); margin-bottom: 2rem; }
.page-header h1 { margin-bottom: 0.25rem; }
.page-header p  { font-size: 1rem; color: var(--ink-muted); margin: 0; max-width: 56ch; }

.section { margin-bottom: 2.5rem; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
    .auth-card { padding: 2rem 1.25rem; }
    .card      { padding: 1.5rem 1.25rem; }
    .module-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
