/* styles.css — Mindful Recovery Circle */

:root{
  --bg: #f7fbfd;
  --surface: #ffffff;
  --text: #0f1f2b;
  --muted: #5b6b79;

  --primary: #0ea5a4;      /* teal */
  --primary-700:#0b7f7e;
  --accent: #3b82f6;       /* soft blue */

  --border: rgba(15,31,43,0.12);
  --shadow: 0 10px 30px rgba(15,31,43,0.10);
  --shadow-soft: 0 8px 20px rgba(15,31,43,0.08);

  --radius: 16px;
  --radius-lg: 22px;
  --container: 1100px;

  --focus: 0 0 0 3px rgba(59,130,246,0.35);
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--text);
  background: linear-gradient(180deg, var(--bg), #eef7fb);
  line-height: 1.5;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1rem; }
h1,h2,h3 { margin: 0 0 .75rem; line-height: 1.15; letter-spacing: -0.02em; }
small { color: var(--muted); }

.container{
  width: min(var(--container), calc(100% - 2rem));
  margin-inline: auto;
}

/* Accessibility */
.skip-link{
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: .6rem .8rem;
  border-radius: 12px;
  z-index: 999;
}
.skip-link:focus{ left: 1rem; top: 1rem; outline: none; box-shadow: var(--focus); }

/* Header + Nav */
.site-header{
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(247,251,253,0.75);
  border-bottom: 1px solid var(--border);
}

.header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 0;
}

.brand{
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 220px;
}

.logo{
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: radial-gradient(circle at 30% 30%, rgba(14,165,164,.25), transparent 55%),
              linear-gradient(135deg, rgba(59,130,246,.18), rgba(14,165,164,.18));
  border: 1px solid rgba(14,165,164,.25);
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--primary-700);
}

.brand-text{ display: grid; gap: .1rem; }
.brand-name{ font-weight: 750; font-size: 1rem; }
.brand-subtitle{ font-size: .85rem; color: var(--muted); }

.site-nav .nav-list{
  display: flex;
  align-items: center;
  gap: .25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a{
  display: inline-flex;
  align-items: center;
  padding: .55rem .85rem;
  border-radius: 999px;
  color: rgba(15,31,43,0.88);
  transition: background .2s ease, color .2s ease, transform .2s ease;
}

.site-nav a:hover{
  background: rgba(14,165,164,0.10);
  color: var(--primary-700);
  transform: translateY(-1px);
}

.site-nav a:focus-visible{
  outline: none;
  box-shadow: var(--focus);
}

.nav-cta{
  margin-left: .35rem;
  background: linear-gradient(135deg, rgba(14,165,164,.18), rgba(59,130,246,.16));
  border: 1px solid rgba(14,165,164,.22);
}

.nav-toggle{
  display: none;
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.65);
  padding: .55rem .7rem;
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(15,31,43,0.05);
  cursor: pointer;
}
.nav-toggle:focus-visible{ outline: none; box-shadow: var(--focus); }
.nav-toggle-label{ font-weight: 650; }
.nav-toggle-bars{
  display: inline-block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin-left: .65rem;
  position: relative;
  top: -1px;
  border-radius: 2px;
}
.nav-toggle-bars::before,
.nav-toggle-bars::after{
  content: "";
  position: absolute;
  left: 0;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}
.nav-toggle-bars::before{ top: -7px; }
.nav-toggle-bars::after{ top: 7px; }

/* Buttons */
.btn{
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: .8rem 1.05rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  cursor: pointer;
  user-select: none;
}
.btn:focus-visible{ outline: none; box-shadow: var(--focus); }

.btn-primary{
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 12px 28px rgba(14,165,164,0.22);
}
.btn-primary:hover{ transform: translateY(-1px); box-shadow: 0 16px 34px rgba(14,165,164,0.26); }

.btn-secondary{
  color: var(--primary-700);
  background: rgba(255,255,255,0.78);
  border-color: rgba(14,165,164,0.25);
}
.btn-secondary:hover{ transform: translateY(-1px); background: rgba(14,165,164,0.08); }

/* Hero */
.hero{
  position: relative;
  isolation: isolate;
  min-height: 72vh;
  display: grid;
  align-items: center;
  padding: 4.75rem 0 4rem;
  background-image:
    linear-gradient(135deg, rgba(14,165,164,0.25), rgba(59,130,246,0.22)),
    url("https://images.unsplash.com/photo-1506126613408-eca07ce68773?auto=format&fit=crop&w=2400&q=70");
  background-size: cover;
  background-position: center;
}
.hero-overlay{
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(10, 25, 35, 0.45);
}
.hero-inner{ display: flex; justify-content: center; text-align: center; }
.hero-content{
  width: min(760px, 100%);
  padding: 2.1rem 1.4rem;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(10px);
}
.eyebrow{
  display: inline-flex;
  padding: .35rem .7rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.9);
  margin: 0 0 1rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.hero-title{
  color: white;
  font-size: clamp(2rem, 3.2vw + 1rem, 3.25rem);
  margin-bottom: .85rem;
}
.hero-subtitle{
  color: rgba(255,255,255,0.88);
  font-size: clamp(1rem, 0.6vw + 0.9rem, 1.2rem);
  margin: 0 auto 1.5rem;
  max-width: 62ch;
}
.hero-actions{
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Sections */
.section-header{
  text-align: center;
  margin: 0 auto 2rem;
  max-width: 72ch;
}
.section-header h2{ font-size: clamp(1.6rem, 1.3vw + 1.15rem, 2.25rem); }
.section-header p{ color: var(--muted); }

/* Features */
.features{ padding: 4rem 0; }
.feature-grid{
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: center;
}
.feature-card{
  flex: 1 1 260px;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.35rem;
  box-shadow: var(--shadow-soft);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.feature-card:hover{
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: rgba(14,165,164,0.25);
}
.feature-icon{
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(14,165,164,0.14), rgba(59,130,246,0.12));
  border: 1px solid rgba(14,165,164,0.18);
  font-size: 1.35rem;
  margin-bottom: 1rem;
}
.feature-card p{ color: var(--muted); margin: 0; }

/* Newsletter */
.newsletter{
  padding: 3.75rem 0;
  background:
    radial-gradient(1200px 320px at 50% 0%, rgba(14,165,164,0.16), transparent 60%),
    radial-gradient(1000px 300px at 10% 40%, rgba(59,130,246,0.12), transparent 55%),
    rgba(255,255,255,0.55);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.newsletter-inner{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}
.newsletter-copy{ flex: 1 1 320px; }
.newsletter-copy p{ color: var(--muted); margin-bottom: 0; }
.newsletter-form{
  flex: 1 1 420px;
  background: var(--surface);
  border: 1px solid rgba(14,165,164,0.18);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: 0 18px 40px rgba(15,31,43,0.10);
}

.form-row{ display: grid; gap: .45rem; margin-bottom: 1rem; }
label{ font-weight: 650; font-size: .95rem; }

input, select, textarea{
  width: 100%;
  padding: .85rem .95rem;
  border-radius: 14px;
  border: 1px solid rgba(15,31,43,0.16);
  background: rgba(247,251,253,0.8);
  color: var(--text);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
  font-family: inherit;
}

textarea{ resize: vertical; }

input:focus, select:focus, textarea:focus{
  outline: none;
  border-color: rgba(59,130,246,0.45);
  box-shadow: var(--focus);
  background: #fff;
}

.form-hint{
  margin: .65rem 0 0;
  color: var(--muted);
  font-size: .9rem;
}

.field-error{
  min-height: 1.1rem;
  margin: .35rem 0 0;
  font-size: .92rem;
  color: #b42318;
}

.legal{
  margin: 1rem 0 0;
  font-size: .92rem;
  color: var(--muted);
}
.legal a{
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--primary-700);
}

/* Auth section on homepage */
.auth{ padding: 3.5rem 0 4.25rem; }
.auth-actions{
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Footer */
.site-footer{
  padding: 2.75rem 0 1.5rem;
  background: rgba(15,31,43,0.95);
  color: rgba(255,255,255,0.92);
}
.footer-inner{
  display: flex;
  gap: 1.75rem;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.footer-block{ flex: 1 1 260px; }
.site-footer h3{ margin-bottom: .65rem; font-size: 1.1rem; }
.site-footer a{
  color: rgba(255,255,255,0.92);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255,255,255,0.35);
}
.site-footer a:hover{ text-decoration-color: rgba(14,165,164,0.75); }

.disclaimer{ color: rgba(255,255,255,0.78); margin: 0; font-size: .95rem; }
.footer-bottom{ padding-top: 1rem; }

/* Shared panels (dashboard/community) */
.panel{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.35rem 1.3rem;
}
.panel-head{ margin-bottom: 1rem; }
.panel-head h2{ margin-bottom: .2rem; font-size: 1.25rem; }
.panel-sub{ margin: 0; color: var(--muted); }

/* Auth page layout */
.auth-page { padding: 2.5rem 0 0; }
.auth-hero { padding: 2.25rem 0 4.25rem; }
.auth-layout{
  display: flex;
  gap: 1.25rem;
  align-items: stretch;
  justify-content: center;
  flex-wrap: wrap;
}
.auth-card{
  flex: 1 1 360px;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.4rem 1.35rem;
}
.auth-card h2{ margin-bottom: 1rem; font-size: 1.35rem; }
.auth-form .btn{ width: 100%; margin-top: .35rem; }

/* Dashboard */
.dashboard-page { padding: 2.25rem 0 0; }
.dashboard-top { padding: 1.25rem 0 4.25rem; }
.dashboard-header{ text-align: left; margin-bottom: 1.5rem; }
.dashboard-title{
  font-size: clamp(1.8rem, 1.4vw + 1.2rem, 2.4rem);
  margin-bottom: .5rem;
}
.dashboard-subtitle{ color: var(--muted); margin: 0; max-width: 70ch; }
.dashboard-grid{
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.dashboard-col{
  flex: 1 1 420px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.counter-value{
  display: flex;
  align-items: baseline;
  gap: .55rem;
  padding: 1rem 1.05rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(14,165,164,0.12), rgba(59,130,246,0.10));
  border: 1px solid rgba(14,165,164,0.18);
}
.counter-value #daysCount{
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--primary-700);
}
.counter-label{ font-weight: 700; color: rgba(15,31,43,0.75); }

.chart-placeholder{
  border-radius: var(--radius);
  border: 1px dashed rgba(15,31,43,0.22);
  background: linear-gradient(180deg, rgba(247,251,253,0.9), rgba(255,255,255,0.6));
  min-height: 320px;
  padding: 1rem;
}
#moodChart{ width: 100% !important; height: 100% !important; }

.reflection-list{
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: .75rem;
}
.reflection-link{
  display: block;
  padding: .9rem .95rem;
  border-radius: 14px;
  border: 1px solid rgba(14,165,164,0.18);
  background: rgba(14,165,164,0.06);
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
}
.reflection-link:hover{
  transform: translateY(-2px);
  background: rgba(59,130,246,0.08);
  border-color: rgba(59,130,246,0.22);
}
.reflection-meta{
  display: inline-block;
  margin-left: .35rem;
  color: var(--muted);
  font-size: .92rem;
}

/* Community */
.community-page { padding: 2.25rem 0 0; }
.community-wrap { padding: 1.25rem 0 4.25rem; }
.community-header { text-align: left; }

.community-grid{
  display: flex;
  gap: 1.25rem;
  align-items: stretch;
  flex-wrap: wrap;
}

.community-sidebar{ flex: 1 1 360px; min-width: 280px; }

.community-chat{
  flex: 2 1 520px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
}

.sidebar-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.sidebar-tools{
  display: flex;
  gap: .6rem;
  margin: .85rem 0 .75rem;
}

.status{
  color: var(--muted);
  font-size: .95rem;
  margin: 0 0 .75rem;
  min-height: 1.1rem;
}

.group-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .65rem;
}

.group-btn{
  width: 100%;
  text-align: left;
  border: 1px solid rgba(15,31,43,0.14);
  background: rgba(247,251,253,0.8);
  border-radius: 16px;
  padding: .85rem .9rem;
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  align-items: flex-start;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.group-btn:hover{
  transform: translateY(-2px);
  border-color: rgba(14,165,164,0.25);
  background: rgba(14,165,164,0.06);
  box-shadow: var(--shadow-soft);
}

.group-item.is-active .group-btn{
  border-color: rgba(59,130,246,0.35);
  background: linear-gradient(135deg, rgba(14,165,164,0.10), rgba(59,130,246,0.08));
}

.group-title{ font-weight: 800; margin-bottom: .2rem; }
.group-desc{
  color: var(--muted);
  font-size: .95rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pill{
  display: inline-flex;
  padding: .25rem .55rem;
  border-radius: 999px;
  border: 1px solid rgba(14,165,164,0.18);
  background: rgba(255,255,255,0.72);
  color: rgba(15,31,43,0.78);
  font-weight: 700;
  font-size: .85rem;
}

.chat-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.chat-messages{
  border: 1px solid rgba(15,31,43,0.12);
  background: rgba(247,251,253,0.7);
  border-radius: 16px;
  padding: 1rem;
  margin-top: .75rem;
  height: 420px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.msg{
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(15,31,43,0.10);
  border-radius: 16px;
  padding: .75rem .8rem;
  box-shadow: 0 8px 18px rgba(15,31,43,0.05);
}
.msg + .msg{ margin-top: .65rem; }

.msg-top{
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .35rem;
}
.msg-sender{ font-weight: 800; }
.msg-time{ color: var(--muted); font-size: .85rem; }
.msg-text{ white-space: pre-wrap; }

.chat-form{
  display: flex;
  gap: .6rem;
  margin-top: .75rem;
}
.chat-form input{ flex: 1; }

.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 35, 0.55);
  z-index: 90;
}
.modal{
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal-card{
  width: min(720px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(135deg, rgba(14,165,164,0.10), rgba(59,130,246,0.08));
  border-bottom: 1px solid var(--border);
}
.modal-body{ padding: 1.1rem; }
.modal-actions{
  display: flex;
  justify-content: flex-end;
  gap: .65rem;
  flex-wrap: wrap;
  margin-top: .25rem;
}
.icon-btn{
  appearance: none;
  border: 1px solid rgba(15,31,43,0.14);
  background: rgba(255,255,255,0.75);
  border-radius: 12px;
  padding: .35rem .55rem;
  cursor: pointer;
}
.icon-btn:focus-visible{ outline: none; box-shadow: var(--focus); }

/* Responsive */
@media (max-width: 860px){
  .newsletter-inner{ flex-direction: column; align-items: stretch; }
  .chat-messages{ height: 360px; }
  .dashboard-col{ flex: 1 1 100%; }
}

@media (max-width: 760px){
  .nav-toggle{ display: inline-flex; align-items: center; gap: .5rem; }

  .site-nav{
    position: absolute;
    top: 100%;
    right: 1rem;
    left: 1rem;
    margin-top: .75rem;
    background: rgba(255,255,255,0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    display: none;
    overflow: hidden;
  }
  .site-nav.is-open{ display: block; }

  .site-nav .nav-list{
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: .35rem;
  }

  .site-nav a{
    padding: .8rem .9rem;
    border-radius: 14px;
  }

  .nav-cta{ margin-left: 0; border-radius: 14px; }

  .hero{ min-height: 68vh; padding: 4rem 0 3.5rem; }
  .hero-content{ padding: 1.6rem 1.1rem; }
}

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; scroll-behavior: auto !important; }
}
