/* ================================================================
   HMWorkout — dashboard.css
   User Dashboard Layout, Components & Data Visualisations
   ================================================================ */

/* ── Layout Shell ────────────────────────────────────────────── */
:root { --sidebar-w: 260px; }

.dash-shell {
  display: flex;
  min-height: 100vh;
  padding-top: var(--nav-h);
  background: var(--bg-base);
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--nav-h);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: calc(var(--z-nav) - 5);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  scrollbar-width: thin;
}

.sidebar-user {
  padding: var(--s-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-name {
  font-weight: var(--fw-bold);
  font-size: var(--fs-base);
  color: var(--t-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-plan { font-size: var(--fs-xs); color: var(--t-muted); }

.sidebar-nav { flex: 1; padding: var(--s-4) var(--s-3); }

.sidebar-section-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--t-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--s-4) var(--s-3) var(--s-2);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  color: var(--t-secondary);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  text-decoration: none;
  transition: var(--ease-fast);
  margin-bottom: 2px;
  position: relative;
}
.sidebar-link i {
  width: 20px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}
.sidebar-link:hover { background: var(--bg-raised); color: var(--t-primary); }
.sidebar-link.active {
  background: rgba(21,87,255,0.10);
  color: var(--c-blue);
  font-weight: var(--fw-semibold);
}
.sidebar-link.active i { color: var(--c-blue); }
.sidebar-link .link-badge {
  margin-left: auto;
  background: var(--c-orange);
  color: #fff;
  font-size: 10px;
  font-weight: var(--fw-bold);
  padding: 2px 7px;
  border-radius: var(--r-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: var(--s-4) var(--s-3);
  border-top: 1px solid var(--border);
}
.sidebar-plan-card {
  background: var(--grad-hero);
  border-radius: var(--r-md);
  padding: var(--s-4);
  color: #fff;
  font-size: var(--fs-sm);
  margin-bottom: var(--s-3);
}
.sidebar-plan-card h4 { font-size: var(--fs-base); font-weight: var(--fw-bold); margin-bottom: var(--s-1); }
.sidebar-plan-card p  { opacity: 0.7; font-size: var(--fs-xs); margin-bottom: var(--s-3); }

/* ── Main Content ────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: var(--s-8) var(--s-8);
  min-width: 0;
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: calc(var(--z-nav) + 5);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: var(--s-5) var(--s-4); }
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: var(--bg-overlay);
    z-index: calc(var(--z-nav) + 4);
    display: none;
  }
  .sidebar-overlay.show { display: block; }
}

/* ── Dashboard Header ────────────────────────────────────────── */
.dash-topbar {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-8);
}
.dash-menu-btn {
  display: none;
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--t-primary);
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
@media (max-width: 1024px) { .dash-menu-btn { display: flex; } }

.dash-greeting    { flex: 1; }
.dash-greeting h1 { font-size: var(--fs-2xl); font-weight: var(--fw-black); line-height: 1.2; }
.dash-greeting p  { color: var(--t-secondary); font-size: var(--fs-base); }

/* ── Stats Grid ──────────────────────────────────────────────── */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-5);
  margin-bottom: var(--s-8);
}
@media (max-width: 1200px) { .stats-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .stats-cards { grid-template-columns: 1fr 1fr; gap: var(--s-3); } }

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  transition: var(--ease-smooth);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 0 var(--r-lg) 0 80px;
  opacity: 0.08;
}
.stat-card.blue::before   { background: var(--c-blue);   }
.stat-card.orange::before { background: var(--c-orange); }
.stat-card.green::before  { background: var(--c-green);  }
.stat-card.gold::before   { background: var(--c-gold);   }

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.stat-card-icon {
  width: 42px; height: 42px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: var(--s-4);
}
.stat-card.blue   .stat-card-icon { background: rgba(21,87,255,0.12);  color: var(--c-blue);   }
.stat-card.orange .stat-card-icon { background: rgba(255,107,26,0.12); color: var(--c-orange); }
.stat-card.green  .stat-card-icon { background: rgba(13,191,111,0.12); color: var(--c-green);  }
.stat-card.gold   .stat-card-icon { background: rgba(245,183,49,0.12); color: #C87800;         }

.stat-card-num {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-black);
  color: var(--t-primary);
  line-height: 1;
  margin-bottom: var(--s-1);
}
.stat-card-label { font-size: var(--fs-sm); color: var(--t-secondary); font-weight: var(--fw-medium); }

/* ── Dashboard Grid ──────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-6);
}
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--s-6);
}
.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-5);
}
.dash-card-title {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--t-primary);
}
.dash-card-action {
  font-size: var(--fs-sm);
  color: var(--c-blue);
  font-weight: var(--fw-semibold);
  text-decoration: none;
}
.dash-card-action:hover { text-decoration: underline; }

/* Full-width card */
.dash-card.full { grid-column: 1 / -1; }

/* ── Today's Workout Card ────────────────────────────────────── */
.today-workout-card {
  background: linear-gradient(135deg, var(--c-navy) 0%, var(--c-navy-mid) 100%);
  border-radius: var(--r-xl);
  padding: var(--s-8);
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: var(--s-6);
}
.today-workout-card::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(21,87,255,0.3) 0%, transparent 70%);
  border-radius: 50%;
}
.today-workout-card::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(255,107,26,0.25) 0%, transparent 70%);
  border-radius: 50%;
}
.twc-inner { position: relative; z-index: 1; }
.twc-tag {
  display: inline-flex; align-items: center; gap: var(--s-2);
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--r-full); padding: 4px 12px;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: 0.06em;
  text-transform: uppercase; color: rgba(255,255,255,0.8); margin-bottom: var(--s-4);
}
.twc-title { font-size: var(--fs-2xl); font-weight: var(--fw-black); margin-bottom: var(--s-4); line-height: 1.2; }
.twc-meta  { display: flex; gap: var(--s-5); flex-wrap: wrap; margin-bottom: var(--s-6); }
.twc-meta-item { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); opacity: 0.75; }
.twc-meta-item i { font-size: 12px; color: var(--c-gold); }
.twc-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.btn-start-workout {
  background: var(--grad-orange);
  color: #fff;
  border: none;
  padding: 14px 32px;
  border-radius: var(--r-full);
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-base);
  cursor: pointer;
  transition: var(--ease-spring);
  box-shadow: var(--shadow-orange);
  display: inline-flex; align-items: center; gap: var(--s-2);
  text-decoration: none;
}
.btn-start-workout:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 12px 40px rgba(255,107,26,0.55); }

/* ── Week Chart ──────────────────────────────────────────────── */
.week-chart {
  display: flex;
  align-items: flex-end;
  gap: var(--s-3);
  height: 100px;
  padding-bottom: var(--s-2);
}
.week-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: var(--s-2); }
.week-bar-track {
  width: 100%; flex: 1;
  background: var(--bg-raised);
  border-radius: var(--r-full);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.week-bar-fill {
  width: 100%;
  background: var(--grad-orange);
  border-radius: var(--r-full);
  transition: height 0.8s cubic-bezier(0.4,0,0.2,1);
  min-height: 4px;
}
.week-bar-fill.empty { background: var(--border); }
.week-day-label { font-size: 11px; color: var(--t-muted); font-weight: var(--fw-medium); }
.week-day-label.done { color: var(--c-blue); font-weight: var(--fw-bold); }
.week-done-icon { font-size: 10px; color: var(--c-green); }

/* ── Activity Feed ───────────────────────────────────────────── */
.activity-item {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-full);
  background: rgba(21,87,255,0.10);
  color: var(--c-blue);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 15px;
}
.activity-info { flex: 1; }
.activity-title { font-weight: var(--fw-semibold); font-size: var(--fs-base); color: var(--t-primary); }
.activity-meta  { font-size: var(--fs-xs); color: var(--t-muted); margin-top: 2px; }
.activity-date  { font-size: var(--fs-xs); color: var(--t-muted); white-space: nowrap; }

/* ── BMI Mini Card ───────────────────────────────────────────── */
.bmi-mini {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4);
  background: var(--bg-raised);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.bmi-mini-val {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: var(--fw-black);
  line-height: 1;
}
.bmi-mini-info { flex: 1; }
.bmi-mini-cat  { font-weight: var(--fw-semibold); font-size: var(--fs-base); }
.bmi-mini-msg  { font-size: var(--fs-xs); color: var(--t-muted); margin-top: 2px; }

/* ── Badges ──────────────────────────────────────────────────── */
.badges-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
}
.badge-item {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2);
  padding: var(--s-3);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  min-width: 64px;
  cursor: default;
  transition: var(--ease-fast);
}
.badge-item:hover { border-color: var(--c-gold); transform: scale(1.05); }
.badge-icon  { font-size: 28px; line-height: 1; }
.badge-icon img { width: 28px; height: 28px; object-fit: contain; }
.badge-name  { font-size: 10px; color: var(--t-muted); font-weight: var(--fw-semibold); text-align: center; }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--s-10);
  color: var(--t-muted);
}
.empty-state i { font-size: 36px; display: block; margin-bottom: var(--s-3); opacity: 0.3; }
.empty-state p { font-size: var(--fs-sm); }

/* ── Sub Expiry Banner ───────────────────────────────────────── */
.sub-banner {
  background: var(--grad-orange);
  border-radius: var(--r-lg);
  padding: var(--s-5) var(--s-6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  margin-bottom: var(--s-6);
}
.sub-banner-text h3 { font-weight: var(--fw-bold); margin-bottom: var(--s-1); }
.sub-banner-text p  { font-size: var(--fs-sm); opacity: 0.8; }

/* ── Streak Display ──────────────────────────────────────────── */
.streak-display {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4);
  background: linear-gradient(135deg, rgba(255,107,26,.08) 0%, rgba(245,183,49,.08) 100%);
  border: 1px solid rgba(255,107,26,0.2);
  border-radius: var(--r-md);
  margin-bottom: var(--s-5);
}
.streak-flame  { font-size: 32px; animation: flamePulse 1.5s ease-in-out infinite; }
.streak-num    { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: var(--fw-black); color: var(--c-orange); }
.streak-label  { font-size: var(--fs-sm); color: var(--t-secondary); }
