/* ===== XPM Moving Acorns — Modern Light Theme (White, Green, Blue) ===== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:            #f8fafc;
  --bg-subtle:     #f1f5f9;
  --card:          #ffffff;
  --card-hover:    #fbfcfe;
  --border:        #e2e8f0;
  --border-focus:  #0ea5e9;
  
  /* Green & Blue Accents */
  --green-primary: #10b981;
  --green-dark:    #059669;
  --green-light:   #ecfdf5;
  --green-border:  #a7f3d0;
  
  --blue-primary:  #2563eb;
  --blue-dark:     #1d4ed8;
  --blue-light:    #eff6ff;
  --blue-border:   #bfdbfe;
  
  --cyan-accent:   #0ea5e9;
  
  /* Gradients */
  --gradient:       linear-gradient(135deg, #10b981 0%, #0ea5e9 50%, #2563eb 100%);
  --gradient-subtle:linear-gradient(135deg, rgba(16,185,129,0.08) 0%, rgba(14,165,233,0.08) 50%, rgba(37,99,235,0.08) 100%);
  --gradient-card:  linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  --gradient-green: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --gradient-blue:  linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  
  /* Typography */
  --text:          #0f172a;
  --text-muted:    #475569;
  --text-dim:      #94a3b8;
  
  /* Status */
  --danger:        #ef4444;
  --danger-light:  #fef2f2;
  --warning:       #f59e0b;
  --warning-light: #fffbeb;
  
  /* Elevation */
  --shadow-sm:     0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow:        0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg:     0 12px 30px -4px rgba(14, 165, 233, 0.12), 0 4px 12px -2px rgba(16, 185, 129, 0.08);
  
  --radius:        16px;
  --radius-sm:     10px;
  --radius-full:   9999px;
  --max-w:         1080px;
  --nav-h:         68px;
  --transition:    .2s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 3rem;
}

a { color: var(--blue-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--blue-dark); }

/* ---------- Utility ---------- */
.container { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.hidden { display: none !important; }

/* ---------- Navigation ---------- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.03);
}
.navbar .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%;
}
.navbar-brand {
  font-size: 1.25rem; font-weight: 800; color: var(--text);
  display: flex; align-items: center; gap: .6rem;
  letter-spacing: -0.02em;
}
.navbar-brand .icon-brand {
  width: 1.6rem; height: 1.6rem;
  color: var(--green-primary);
}

/* ---------- Lucide Icons & Badges ---------- */
.lucide {
  width: 1.2em; height: 1.2em;
  vertical-align: -0.2em;
  stroke-width: 2.2;
  display: inline-block;
}
.icon-brand {
  width: 1.5em; height: 1.5em;
  color: var(--green-primary);
  vertical-align: -0.25em;
}
.icon-lg {
  width: 1.4em; height: 1.4em;
  vertical-align: -0.22em;
}
.icon-blue { color: var(--blue-primary); }
.icon-green { color: var(--green-dark); }

/* Rank Badges for Leaderboard (replacing emoji medals) */
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 30px; padding: 0 8px;
  border-radius: 8px; font-weight: 800; font-size: .88rem;
}
.rank-1 {
  background: #fef9c3; color: #854d0e; border: 1.5px solid #fde047;
}
.rank-2 {
  background: #f1f5f9; color: #475569; border: 1.5px solid #cbd5e1;
}
.rank-3 {
  background: #ffedd5; color: #9a3412; border: 1.5px solid #fdba74;
}
.rank-num {
  font-weight: 700; color: var(--text-muted); font-size: .95rem;
  padding: 0 4px;
}

/* Dual Weekly Goals Grid (Personal + Pod) */
.weekly-goals-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem;
  margin: 1.25rem 0;
}
.goal-subcard {
  background: #ffffff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.goal-subcard.pod-subcard {
  border-color: var(--blue-border);
  background: linear-gradient(180deg, #ffffff 0%, #f0f7ff 100%);
}
@media (max-width: 640px) {
  .weekly-goals-grid { grid-template-columns: 1fr; gap: 1rem; }
}
.navbar-links {
  display: flex; gap: .5rem; list-style: none; align-items: center;
}
.navbar-links a {
  color: var(--text-muted); font-weight: 600; font-size: .95rem;
  padding: .5rem 1rem; border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.navbar-links a:hover {
  color: var(--blue-primary); background: var(--blue-light);
}
.navbar-links a.active {
  color: var(--blue-primary); background: var(--blue-light);
  font-weight: 700;
}

/* Mobile Nav Toggle */
.nav-toggle {
  display: none; background: #ffffff; border: 1px solid var(--border);
  color: var(--text); font-size: 1.25rem; cursor: pointer;
  width: 42px; height: 42px; border-radius: 10px;
  align-items: center; justify-content: center;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  background: radial-gradient(ellipse at 50% 0%, rgba(14, 165, 233, 0.08) 0%, rgba(16, 185, 129, 0.04) 50%, transparent 80%);
}
.hero h1 {
  font-size: 2.25rem; font-weight: 800; letter-spacing: -0.03em;
  color: var(--text); line-height: 1.2;
}
.hero h1 .gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero .subtitle {
  color: var(--text-muted); font-size: 1.05rem; margin-top: .5rem; font-weight: 500;
}
.hero .dates {
  display: inline-flex; align-items: center; gap: .5rem;
  margin-top: .75rem; padding: .4rem 1rem;
  background: #ffffff; border: 1px solid var(--blue-border);
  border-radius: var(--radius-full);
  font-size: .85rem; font-weight: 600; color: var(--blue-dark);
  box-shadow: var(--shadow-sm);
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.card-title {
  font-size: 1.15rem; font-weight: 700; color: var(--text);
  margin-bottom: 1rem; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: .5rem;
}

/* Featured Weekly Goal Card (Home Hero) */
.featured-goal-card {
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
  border: 2px solid var(--green-border);
  border-radius: 20px;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.featured-goal-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 6px;
  background: var(--gradient);
}
.goal-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 1.25rem; gap: 1rem; flex-wrap: wrap;
}
.goal-title {
  font-size: 1.35rem; font-weight: 800; color: var(--text);
  display: flex; align-items: center; gap: .5rem;
}
.goal-subtitle {
  font-size: .9rem; color: var(--text-muted); font-weight: 500; margin-top: .15rem;
}
.goal-chip {
  padding: .35rem .85rem; border-radius: var(--radius-full);
  font-size: .85rem; font-weight: 700;
  background: var(--blue-light); color: var(--blue-primary);
  border: 1px solid var(--blue-border);
}

/* ---------- Progress Bars ---------- */
/* Large Weekly Bar */
.progress-container-large {
  margin: 1.25rem 0;
}
.progress-labels {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: .6rem;
}
.progress-big-number {
  font-size: 2rem; font-weight: 800; color: var(--green-dark);
  letter-spacing: -0.02em;
}
.progress-target {
  font-size: 1rem; font-weight: 600; color: var(--text-muted);
}
.progress-bar-large-wrap {
  width: 100%; height: 26px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.08);
  position: relative;
}
.progress-bar-large {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gradient);
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 6px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

/* Small Big-Picture Bar */
.big-picture-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-top: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.big-picture-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .5rem; font-size: .88rem; font-weight: 600;
}
.progress-bar-small-wrap {
  width: 100%; height: 10px;
  background: var(--bg-subtle);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar-small {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gradient-blue);
  transition: width 0.8s ease;
  min-width: 4px;
}

/* Default / Thin Bars */
.progress-wrap {
  width: 100%; background: #e2e8f0; border-radius: var(--radius-full);
  height: 14px; overflow: hidden;
}
.progress-bar {
  height: 100%; border-radius: var(--radius-full);
  background: var(--gradient);
  transition: width .8s ease;
}
.progress-wrap.thin, .progress-bar.thin { height: 8px; }

/* ---------- Stat Cards ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: #ffffff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1rem;
  text-align: center; box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card .stat-label {
  font-size: .8rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .06em; font-weight: 700; margin-bottom: .35rem;
}
.stat-card .stat-value {
  font-size: 2rem; font-weight: 800; color: var(--text);
  letter-spacing: -0.02em;
}
.stat-card .stat-sub { font-size: .8rem; color: var(--text-dim); margin-top: .2rem; }

/* ---------- Quick Action Buttons ---------- */
.quick-actions {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .75rem; margin-top: 1.25rem;
}
.quick-action-btn {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1rem; border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 700;
  background: #ffffff; border: 1px solid var(--border);
  color: var(--text); box-shadow: var(--shadow-sm);
  transition: all var(--transition); min-height: 48px;
}
.quick-action-btn:hover {
  border-color: var(--blue-primary); color: var(--blue-primary);
  background: var(--blue-light); transform: translateY(-1px);
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: #ffffff;
}
table { width: 100%; border-collapse: collapse; min-width: 520px; }
thead th {
  text-align: left; padding: .85rem 1rem; font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted);
  background: #f8fafc; border-bottom: 1px solid var(--border);
}
tbody td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); font-size: .92rem; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
tbody tr.highlight { background: #f0fdf4; border-left: 3px solid var(--green-primary); }
.rank-cell { font-weight: 800; font-size: 1.15rem; }

/* ---------- Forms & Inputs (Mobile Optimized) ---------- */
.form-group { margin-bottom: 1.25rem; text-align: left; }
.form-group label {
  display: block; font-size: .9rem; font-weight: 600; margin-bottom: .45rem;
  color: var(--text);
}
input[type="text"],
input[type="number"],
input[type="date"],
input[type="url"],
select {
  width: 100%; padding: .8rem 1rem; font-size: 16px; /* 16px prevents iOS zoom */
  background: #ffffff; color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit; min-height: 48px;
}
input:focus, select:focus {
  outline: none; border-color: var(--blue-primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.5rem; font-size: 1rem; font-weight: 700;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  font-family: inherit; transition: all var(--transition);
  min-height: 48px; text-decoration: none;
}
.btn-primary {
  background: var(--gradient); color: #ffffff;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.25);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.35); transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: #ffffff; color: var(--text);
  border: 1.5px solid var(--border); box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: var(--bg-subtle); border-color: #cbd5e1;
}

.btn-blue {
  background: var(--gradient-blue); color: #ffffff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.25);
}
.btn-blue:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35); }

.btn-sm {
  padding: .45rem 1rem; font-size: .85rem; min-height: 38px;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- Tabs (Log In vs Join) ---------- */
.auth-tabs {
  display: flex; gap: .5rem; margin-bottom: 1.5rem;
  background: var(--bg-subtle); padding: .3rem; border-radius: var(--radius-sm);
}
.auth-tab {
  flex: 1; padding: .65rem; border: none; background: transparent;
  font-size: .95rem; font-weight: 700; color: var(--text-muted);
  border-radius: 8px; cursor: pointer; transition: all var(--transition);
  min-height: 42px;
}
.auth-tab.active {
  background: #ffffff; color: var(--blue-primary);
  box-shadow: var(--shadow-sm);
}

/* ---------- Webhook Box ---------- */
.webhook-box {
  display: flex; align-items: center; gap: .75rem;
  background: var(--bg-subtle); border: 1.5px dashed #cbd5e1;
  border-radius: var(--radius-sm); padding: .75rem 1rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: .85rem; word-break: break-all;
  color: var(--blue-dark); font-weight: 600;
}
.webhook-box .copy-btn { flex-shrink: 0; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .25rem .65rem; font-size: .78rem; font-weight: 700;
  border-radius: var(--radius-full);
}
.badge-success { background: var(--green-light); color: var(--green-dark); border: 1px solid var(--green-border); }
.badge-blue    { background: var(--blue-light); color: var(--blue-dark); border: 1px solid var(--blue-border); }
.badge-danger  { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }

/* ---------- Platform Instructions ---------- */
.instructions {
  background: #ffffff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; margin-top: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.instructions h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: .75rem; }
.instructions ol { padding-left: 1.35rem; color: var(--text-muted); }
.instructions ol li { margin-bottom: .5rem; line-height: 1.5; }
.instructions ol li strong { color: var(--text); }
.instructions .platform-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }
.instructions .platform-tab {
  padding: .5rem 1.25rem; border-radius: var(--radius-full); font-size: .88rem;
  font-weight: 600; cursor: pointer; border: 1.5px solid var(--border);
  background: #ffffff; color: var(--text-muted); transition: all var(--transition);
  min-height: 40px;
}
.instructions .platform-tab.active {
  background: var(--blue-primary); color: #ffffff; border-color: var(--blue-primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: #ffffff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .85rem 1.25rem;
  font-size: .92rem; font-weight: 600; color: var(--text);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15);
  transform: translateY(120%); opacity: 0;
  transition: all .3s ease; z-index: 9999;
  max-width: 90vw;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-left: 4px solid var(--green-primary); }
.toast.error   { border-left: 4px solid var(--danger); }

/* ---------- Week Cards Grid ---------- */
.week-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.week-card { padding: 1.25rem; }
.week-card .week-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .6rem;
}
.week-card .week-header h3 { font-size: 1rem; font-weight: 700; color: var(--text); }
.week-card .week-users { margin-top: .75rem; }
.week-card .week-user {
  display: flex; justify-content: space-between; align-items: center;
  padding: .35rem 0; font-size: .88rem; color: var(--text-muted);
  border-bottom: 1px solid #f1f5f9;
}
.week-card .week-user:last-child { border-bottom: none; }
.week-card .week-user .steps { font-weight: 700; color: var(--text); }

/* ---------- Chart Container ---------- */
.chart-container {
  background: #ffffff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  position: relative; min-height: 320px; box-shadow: var(--shadow-sm);
}

/* ---------- Loader & Empty States ---------- */
.loader {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem; color: var(--text-muted); font-weight: 600;
}
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border);
  border-top-color: var(--blue-primary); border-radius: 50%;
  animation: spin .8s linear infinite; margin-right: .75rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state .empty-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--bg-subtle); color: var(--text-dim);
  margin-bottom: .85rem;
}
.empty-state .empty-icon .lucide {
  width: 26px; height: 26px; stroke-width: 2;
}

.page-section { padding: 2rem 0; }
.section-title {
  font-size: 1.35rem; font-weight: 800; margin-bottom: 1.25rem;
  letter-spacing: -0.02em; display: flex; align-items: center; gap: .5rem;
}

/* ---------- Mobile Responsive Optimization ---------- */
@media (max-width: 768px) {
  .hero { padding: 2rem 1rem 1rem; }
  .hero h1 { font-size: 1.85rem; }
  .hero .subtitle { font-size: .95rem; }
  
  .navbar-links {
    display: none; flex-direction: column; position: absolute;
    top: var(--nav-h); left: 0; right: 0;
    background: #ffffff; border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem; gap: .5rem;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
  }
  .navbar-links.open { display: flex; }
  .nav-toggle { display: inline-flex; }
  
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .stat-card { padding: 1rem .75rem; }
  .stat-card .stat-value { font-size: 1.6rem; }
  
  .featured-goal-card { padding: 1.25rem; border-radius: 16px; }
  .progress-big-number { font-size: 1.7rem; }
  .progress-bar-large-wrap { height: 22px; }
  
  .quick-actions { grid-template-columns: 1fr; }
  
  .webhook-box { flex-direction: column; align-items: stretch; gap: .5rem; }
  .webhook-box .copy-btn { width: 100%; }
  
  .week-grid { grid-template-columns: 1fr; }
  
  /* Make table scrollable smoothly on mobile */
  .table-wrap { margin: 0 -8px; border-radius: 0; border-left: none; border-right: none; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.6rem; }
  .stat-grid { grid-template-columns: 1fr; }
}
