/* ── RESET & BASE ────────────────────────────────────────────────────────────*/
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface2:  #1c2330;
  --surface3:  #21262d;
  --border:    rgba(255,255,255,0.08);
  --border2:   rgba(255,255,255,0.14);
  --text:      #e6edf3;
  --muted:     #8b949e;
  --muted2:    #6e7681;
  --accent:    #3b82f6;
  --radius:    10px;
  --radius-lg: 14px;
}

html { scroll-behavior: smooth; }
body { font-family: 'Sora', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.6; }

/* ── AUTH OVERLAY ────────────────────────────────────────────────────────────*/
.auth-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 1rem;
}
.auth-modal {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); padding: 2.25rem 2rem;
  width: 100%; max-width: 380px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7); text-align: center;
}
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 1.25rem; }
.auth-logo-icon {
  width: 44px; height: 44px; background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.25); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.auth-logo-text { font-family: 'IBM Plex Mono', monospace; font-size: 14px; font-weight: 600; color: var(--text); text-align: left; line-height: 1.3; }
.auth-logo-sub  { font-size: 11px; color: var(--muted); font-weight: 400; }
.auth-desc      { font-size: 13px; color: var(--muted); margin-bottom: 1.5rem; line-height: 1.5; }
.auth-error     { font-size: 12.5px; color: #f87171; background: rgba(248,113,113,0.08); border: 1px solid rgba(248,113,113,0.2); border-radius: 6px; padding: 8px 12px; margin-bottom: 1rem; display: none; text-align: left; }
.google-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 13px 20px; background: #fff; border: none; border-radius: 8px;
  color: #3c4043; font-family: 'Sora', sans-serif; font-size: 15px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35); transition: box-shadow 0.2s, background 0.15s;
}
.google-btn:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.45); background: #f8f8f8; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 1rem 0; color: var(--muted2); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border2); }
.auth-guest-btn { width: 100%; padding: 10px; background: transparent; border: 1px solid var(--border2); border-radius: 8px; color: var(--muted); font-family: 'Sora', sans-serif; font-size: 13px; cursor: pointer; transition: all 0.15s; }
.auth-guest-btn:hover { color: var(--text); background: var(--surface2); }
.auth-note { font-size: 11.5px; color: var(--muted2); margin-top: 1.25rem; line-height: 1.5; }

/* ── GLOBAL NAV ──────────────────────────────────────────────────────────────*/
.global-nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; height: 56px;
  background: rgba(13,17,23,0.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav-brand-icon { font-size: 20px; }
.nav-brand-name { font-family: 'IBM Plex Mono', monospace; font-size: 14px; font-weight: 600; color: var(--text); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-user  { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.nav-guest { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.nav-guest-label { color: var(--muted); }
.nav-avatar-img  { width: 28px; height: 28px; border-radius: 50%; }
.nav-avatar-fallback { width: 28px; height: 28px; border-radius: 50%; background: rgba(59,130,246,0.15); border: 1px solid rgba(59,130,246,0.3); display: flex; align-items: center; justify-content: center; font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600; color: var(--accent); }
#navUserName { color: var(--text); font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-btn { font-size: 12px; color: var(--muted2); cursor: pointer; padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border2); background: transparent; font-family: 'Sora', sans-serif; transition: all 0.15s; text-decoration: none; }
.nav-btn:hover { color: var(--text); border-color: var(--border2); background: var(--surface2); }
.nav-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.nav-btn-primary:hover { background: #2563eb; border-color: #2563eb; color: #fff; }
.sync-badge { font-size: 11px; color: #1dab73; display: flex; align-items: center; gap: 5px; }
.sync-dot   { width: 6px; height: 6px; border-radius: 50%; background: #1dab73; display: inline-block; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ── HOME PAGE ───────────────────────────────────────────────────────────────*/
.home-hero {
  padding: 4rem 1.5rem 3rem;
  max-width: 900px; margin: 0 auto; text-align: center;
}
.home-hero-eyebrow {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 1rem;
}
.home-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 1rem;
}
.home-hero-sub { font-size: 1rem; color: var(--muted); max-width: 480px; margin: 0 auto 2.5rem; font-weight: 300; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  max-width: 900px; margin: 0 auto; padding: 0 1.5rem 4rem;
}

.module-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  cursor: pointer; text-decoration: none; display: block;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  position: relative; overflow: hidden;
}
.module-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--module-accent, var(--accent));
  opacity: 0; transition: opacity 0.2s;
}
.module-card:hover { border-color: var(--border2); box-shadow: 0 8px 32px rgba(0,0,0,0.3); transform: translateY(-2px); }
.module-card:hover::before { opacity: 1; }

.module-card-icon  { font-size: 2rem; margin-bottom: 1rem; display: block; }
.module-card-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; letter-spacing: -0.01em; }
.module-card-sub   { font-size: 12px; color: var(--muted); margin-bottom: 0.75rem; font-family: 'IBM Plex Mono', monospace; }
.module-card-desc  { font-size: 13px; color: var(--muted); line-height: 1.55; margin-bottom: 1.25rem; }

.module-card-meta  { display: flex; align-items: center; justify-content: space-between; }
.module-card-tags  { display: flex; gap: 6px; flex-wrap: wrap; }
.module-tag { font-family: 'IBM Plex Mono', monospace; font-size: 10px; padding: 2px 8px; border-radius: 99px; background: var(--surface3); color: var(--muted); }

.module-progress-row { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.module-progress-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.module-progress-pct { font-family: 'IBM Plex Mono', monospace; color: var(--text); }
.module-prog-bar { height: 3px; border-radius: 99px; background: var(--surface3); }
.module-prog-fill { height: 3px; border-radius: 99px; background: var(--module-accent, var(--accent)); transition: width 0.4s ease; }

.module-card-cta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--module-accent, var(--accent));
  margin-top: 1rem;
}

/* ── MODULE VIEW ─────────────────────────────────────────────────────────────*/
/* Reuses .hero, .app-body, .sidebar, .main-content, .day-card etc.
   from the existing styles.css — just needs a back button */
.module-back-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 0.75rem 1.5rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.module-back-btn {
  display: flex; align-items: center; gap: 6px;
  color: var(--muted); text-decoration: none; cursor: pointer;
  background: none; border: none; font-family: 'Sora', sans-serif;
  font-size: 13px; transition: color 0.15s; padding: 0;
}
.module-back-btn:hover { color: var(--text); }
.module-back-sep { color: var(--border2); }
.module-back-current { color: var(--muted2); }

/* ── EMPTY/LOADING STATES ────────────────────────────────────────────────────*/
.state-container { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 5rem 1.5rem; text-align: center; color: var(--muted); gap: 1rem; }
.state-icon  { font-size: 3rem; opacity: 0.4; }
.state-title { font-size: 1.1rem; font-weight: 500; color: var(--text); }
.state-sub   { font-size: 13px; max-width: 360px; line-height: 1.6; }

/* ── RESPONSIVE ──────────────────────────────────────────────────────────────*/
@media (max-width: 640px) {
  .module-grid { grid-template-columns: 1fr; }
  .home-hero   { padding: 2.5rem 1.25rem 2rem; }
}

/* ── AUTH FORM STYLES ────────────────────────────────────────────────────────*/
.auth-tabs {
  display: flex; background: var(--surface2);
  border-radius: 8px; padding: 3px; margin-bottom: 1.5rem; gap: 3px;
}
.auth-tab {
  flex: 1; padding: 7px; border: none; background: transparent;
  border-radius: 6px; color: var(--muted);
  font-family: 'Sora', sans-serif; font-size: 13px; cursor: pointer; transition: all 0.15s;
}
.auth-tab.active { background: var(--surface3); color: var(--text); font-weight: 500; }

.auth-field { margin-bottom: 1rem; }
.auth-label {
  display: block; font-size: 11px; color: var(--muted);
  margin-bottom: 6px; font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.auth-input {
  width: 100%; background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 8px; padding: 10px 14px; color: var(--text);
  font-family: 'Sora', sans-serif; font-size: 14px; outline: none; transition: border-color 0.15s;
}
.auth-input:focus { border-color: var(--accent); }
.auth-input::placeholder { color: var(--muted2); }

.auth-btn {
  width: 100%; padding: 11px; background: var(--accent); border: none;
  border-radius: 8px; color: #fff; font-family: 'Sora', sans-serif;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity 0.15s; margin-top: 0.25rem;
}
.auth-btn:hover   { opacity: 0.9; }
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-success {
  font-size: 12.5px; color: #1dab73; background: rgba(29,171,115,0.08);
  border: 1px solid rgba(29,171,115,0.25); border-radius: 6px;
  padding: 8px 12px; margin-bottom: 1rem;
}
