/* ============================================================
   HabitFuel — Main Design System
   Font: Syne (display) + DM Sans (body) — sharp & energetic
   Palette: Near-black bg, electric sky blue accent
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --bg:          #0d0d0f;
  --bg-2:        #141417;
  --bg-3:        #1c1c21;
  --bg-4:        #242429;
  --border:      #2a2a30;
  --border-2:    #3a3a42;

  --text:        #f0f0f4;
  --text-2:      #9898aa;
  --text-3:      #606070;

  --accent:      #38bdf8;   /* sky blue */
  --accent-dim:  #1e7aaa;
  --accent-glow: rgba(56, 189, 248, 0.15);

  --blue-mid:    #5b8dd9;   /* partial complete */
  --green:       #4ade80;
  --red:         #f87171;
  --yellow:      #fbbf24;

  --radius:      10px;
  --radius-lg:   16px;
  --sidebar-w:   220px;
  --sidebar-w-c: 60px;      /* collapsed */
  --transition:  0.2s ease;

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ── App Shell ─────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2rem 2.5rem;
  transition: margin-left var(--transition);
  max-width: 100%;
  overflow-x: hidden;
}

.main-content.sidebar-collapsed {
  margin-left: var(--sidebar-w-c);
}

/* ── Page Header ───────────────────────────────────────────── */
.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.page-subtitle {
  color: var(--text-2);
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color var(--transition);
}

.card:hover { border-color: var(--border-2); }

.card-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin-bottom: 1rem;
}

/* ── Grid Layouts ──────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .main-content { padding: 1rem 1.25rem; margin-left: var(--sidebar-w-c); }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--accent);
  color: #000;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius);
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary:hover { background: #7dd3fc; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-2);
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  transition: all var(--transition);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  color: var(--text-3);
  font-size: 0.9rem;
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-4); color: var(--text); }
.btn-danger:hover { color: var(--red); }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: border-color var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-select option { background: var(--bg-3); }
.form-textarea { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Progress Bars ─────────────────────────────────────────── */
.progress-wrap {
  background: var(--bg-4);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
  margin-top: 0.5rem;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.6s cubic-bezier(.34,1.56,.64,1);
}

/* ── Heatmap ───────────────────────────────────────────────── */
.heatmap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.heat-cell {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  cursor: default;
  transition: transform var(--transition);
}
.heat-cell:hover { transform: scale(1.4); }
.heat-0 { background: var(--bg-4); }
.heat-1 { background: #1d4fd840; }
.heat-2 { background: var(--blue-mid); }
.heat-3 { background: var(--accent); }

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-3);
  font-size: 0.95rem;
}

/* ── Spinner ───────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utility ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-2); }
