/* ============================================
   habits.css — Habit Tracker: habit list/cards, streaks, history calendar
   modal, progress summary, 7-day strip, category badges, heatmap.
   Part of the app.css split.
   ============================================ */

/* ── Habit List ── */
.habit-list {
    display: flex; flex-direction: column; gap: 10px;
}
.habit-card {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 18px;
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all var(--transition);
}
.habit-card:hover { border-color: var(--border-light); background: var(--bg-elevated); }
.habit-card.done { border-color: var(--success); background: rgba(46,204,113,0.05); }

.habit-check {
    width: 30px; height: 30px; border-radius: 50%;
    border: 2.5px solid var(--border-light);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0; font-size: 1rem;
    transition: all var(--transition); background: transparent; color: transparent;
}
.habit-check:hover { border-color: var(--success); background: rgba(46,204,113,0.1); }
.habit-card.done .habit-check {
    background: var(--success); border-color: var(--success); color: #fff;
}

.habit-info { flex: 1; min-width: 0; }
.habit-name {
    font-weight: 600; font-size: 0.95rem; color: var(--text-primary);
    display: flex; align-items: center; gap: 8px;
}
.habit-color-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.habit-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.habit-streak {
    display: flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 12px;
    background: var(--gold-dim); color: var(--gold);
    font-size: 0.78rem; font-weight: 600; white-space: nowrap;
}
.habit-streak i { font-size: 0.9rem; }

/* Badge group (streak + total count) */
.habit-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.habit-badge {
    display: flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 12px;
    font-size: 0.78rem; font-weight: 600; white-space: nowrap;
}
.habit-badge.streak { background: var(--gold-dim); color: var(--gold); }
.habit-badge.count  {
    background: rgba(52,152,219,0.13); color: #5dade2;
    cursor: pointer; transition: background var(--transition);
}
.habit-badge.count:hover { background: rgba(52,152,219,0.25); }
.habit-badge i { font-size: 0.9rem; }

/* ── Habit History Calendar Modal ── */
.habit-cal-nav {
    display: flex; align-items: center; justify-content: center; gap: 14px;
    margin-bottom: 18px;
}
.habit-cal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
    margin-bottom: 14px;
}
.habit-cal-header {
    text-align: center; font-size: 0.7rem; font-weight: 700;
    color: var(--text-muted); padding: 4px 0;
}
.habit-cal-cell {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; font-size: 0.8rem; font-weight: 500;
    border: 1px solid var(--border); transition: all 0.15s;
}
.habit-cal-cell:not(.empty):not(.future) { cursor: pointer; }
.habit-cal-cell:not(.empty):not(.future):not(.done):hover { border-color: var(--gold); color: var(--gold); }
.habit-cal-cell.done { color: var(--bg-main); font-weight: 700; border: none; }
.habit-cal-cell.today:not(.done) { border-color: var(--gold); font-weight: 700; color: var(--gold); }
.habit-cal-cell.future { opacity: 0.28; cursor: default; }
.habit-cal-cell.empty  { border: none; cursor: default; }
.habit-cal-summary {
    text-align: center; padding: 12px 0 4px;
    font-size: 0.82rem; color: var(--text-muted); border-top: 1px solid var(--border);
}
.habit-cal-summary strong { color: var(--text-primary); }

/* ── Habit Progress Summary ── */
.habit-progress-summary {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 18px;
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.habit-progress-text {
    display: flex; flex-direction: column; gap: 2px;
}
.habit-progress-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.habit-progress-value { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.habit-progress-bar-wrap {
    flex: 1; height: 6px; background: var(--bg-active);
    border-radius: 3px; overflow: hidden;
}
.habit-progress-bar {
    height: 100%; border-radius: 3px;
    background: linear-gradient(90deg, var(--gold), var(--success));
    transition: width 0.4s ease;
}
.habit-progress-pct { font-size: 0.88rem; font-weight: 600; color: var(--gold); min-width: 36px; text-align: right; }

.habit-analytics { margin-bottom: -6px; }
.habit-analytics-grid {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
}
.habit-analytic-card {
    padding: 12px 14px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; display: flex; flex-direction: column; gap: 6px;
}
.habit-analytic-label { font-size: 0.74rem; color: var(--text-muted); }
.habit-analytic-card strong { font-size: 1rem; color: var(--text-primary); }

/* ── Habit 7-day Strip ── */
.habit-week-strip {
    display: flex; gap: 4px; margin-top: 6px;
}
.habit-week-day {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.habit-week-label {
    font-size: 0.6rem; color: var(--text-muted); font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.habit-week-dot {
    width: 14px; height: 14px; border-radius: 50%;
    border: 1.5px solid var(--border-light);
    transition: all var(--transition);
}
.habit-week-dot.done {
    border-color: transparent;
}
.habit-week-dot.today {
    box-shadow: 0 0 0 2px var(--bg-darkest), 0 0 0 3px currentColor;
}

/* ── Habit Category Badge ─────────────────── */
.habit-category-badge {
  display: inline-block;
  font-size: 0.68rem;
  padding: 1px 8px;
  border-radius: 10px;
  background: rgba(186, 154, 66, 0.15);
  color: var(--gold);
  margin-left: 6px;
  vertical-align: middle;
  font-weight: 500;
}

/* ── Habit Heatmap ─────────────────── */
.heatmap-section {
  margin-top: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
}
.heatmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.heatmap-header span {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(53, 1fr);
  gap: 2px;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.04);
  min-width: 0;
}
.heatmap-cell.level-1 { background: rgba(186, 154, 66, 0.2); }
.heatmap-cell.level-2 { background: rgba(186, 154, 66, 0.4); }
.heatmap-cell.level-3 { background: rgba(186, 154, 66, 0.6); }
.heatmap-cell.level-4 { background: rgba(186, 154, 66, 0.85); }
.heatmap-months {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 6px;
  padding: 0 2px;
}
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 8px;
  justify-content: flex-end;
}
.heatmap-legend-cell {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.04);
}
.heatmap-legend-cell.level-1 { background: rgba(186, 154, 66, 0.2); }
.heatmap-legend-cell.level-2 { background: rgba(186, 154, 66, 0.4); }
.heatmap-legend-cell.level-3 { background: rgba(186, 154, 66, 0.6); }
.heatmap-legend-cell.level-4 { background: rgba(186, 154, 66, 0.85); }

@media (max-width: 768px) {
    .habit-analytics-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .heatmap-grid { gap: 1px; }
}
