/* ============================================================
   styles.css — BODYPLANNER.FIT
   ============================================================ */

:root {
  --bg-primary: #0a0a0f;
  --bg-card: #12121a;
  --bg-card-hover: #1a1a26;
  --bg-input: #1a1a26;
  --border: #2a2a3a;
  --text-primary: #f0f0f5;
  --text-secondary: #8888a0;
  --text-muted: #55556a;
  --accent-green: #00e676;
  --accent-green-dim: rgba(0,230,118,0.15);
  --accent-red: #ff5252;
  --accent-red-dim: rgba(255,82,82,0.12);
  --accent-blue: #448aff;
  --accent-blue-dim: rgba(68,138,255,0.12);
  --accent-orange: #ffab40;
  --accent-orange-dim: rgba(255,171,64,0.12);
  --accent-purple: #b388ff;
  --accent-purple-dim: rgba(179,136,255,0.12);
  --accent-cyan: #18ffff;
  --accent-cyan-dim: rgba(24,255,255,0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 30px rgba(0,0,0,0.4);
}

* { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed; left:0; top:0;
  width:72px; height:100vh;
  background: var(--bg-card);
  border-right:1px solid var(--border);
  display:flex; flex-direction:column; align-items:center;
  padding:20px 0; z-index:100;
  transition: width 0.3s ease;
}
.sidebar .logo {
  font-family:'Bebas Neue',sans-serif;
  font-size:22px; letter-spacing:2px;
  color:var(--accent-green);
  writing-mode:vertical-rl; text-orientation:mixed;
  margin-bottom:40px; transform:rotate(180deg);
}
.nav-items { display:flex; flex-direction:column; gap:8px; flex:1; }
.nav-item {
  width:44px; height:44px; border-radius:var(--radius-sm);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition:all 0.2s; position:relative;
  color:var(--text-muted);
}
.nav-item:hover { background:var(--bg-card-hover); color:var(--text-secondary); }
.nav-item.active { background:var(--accent-green-dim); color:var(--accent-green); }
.nav-item.active::before {
  content:''; position:absolute; left:-14px; top:50%; transform:translateY(-50%);
  width:3px; height:24px; background:var(--accent-green); border-radius:0 3px 3px 0;
  transition: top 0.3s ease;
}
.nav-item svg { width:22px; height:22px; }

/* ── Main layout ─────────────────────────────────────────── */
.main { margin-left:72px; padding:28px 36px; max-width:1400px; }
.header { display:flex; justify-content:space-between; align-items:center; margin-bottom:28px; flex-wrap:wrap; gap:12px; }
.header h1 { font-family:'Bebas Neue',sans-serif; font-size:38px; letter-spacing:3px; font-weight:400; }
.header h1 span { color:var(--accent-green); }
.header-right { display:flex; align-items:center; gap:14px; flex-wrap:wrap; }

/* ── Week Nav ────────────────────────────────────────────── */
.week-nav {
  display:flex; align-items:center; gap:10px;
  background:var(--bg-card); border:1px solid var(--border);
  border-radius:50px; padding:6px 10px;
}
.week-nav button {
  width:30px; height:30px; border-radius:50%; border:none;
  background:transparent; color:var(--text-secondary); cursor:pointer;
  display:flex; align-items:center; justify-content:center; transition:all 0.2s;
}
.week-nav button:hover { background:var(--bg-card-hover); color:var(--text-primary); }
.week-nav button:active { transform: scale(0.9); }
.week-nav .week-label { font-weight:600; font-size:13px; min-width:120px; text-align:center; }

/* ── Badges ──────────────────────────────────────────────── */
.streak-badge {
  background:var(--accent-orange-dim); color:var(--accent-orange);
  padding:8px 16px; border-radius:50px; font-size:13px; font-weight:600;
  display:flex; align-items:center; gap:6px;
}
.btn-history {
  background:var(--accent-purple-dim); color:var(--accent-purple);
  border:1px solid rgba(179,136,255,0.3);
  padding:8px 20px; border-radius:50px; font-family:'DM Sans',sans-serif;
  font-size:13px; font-weight:600; cursor:pointer; transition:all 0.2s;
  display:flex; align-items:center; gap:6px;
}
.btn-history:hover { background:var(--accent-purple); color:var(--bg-primary); }

/* ── Page transitions ────────────────────────────────────── */
.page { display:none; animation:fadeIn 0.35s ease; }
.page.active { display:block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:none} }

/* ── Stats Row ───────────────────────────────────────────── */
.stats-row { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:24px; }
.stat-card {
  background:var(--bg-card); border:1px solid var(--border);
  border-radius:var(--radius); padding:18px; position:relative; overflow:hidden;
  transition: border-color 0.3s, transform 0.2s;
}
.stat-card:hover {
  border-color:var(--accent-green);
  transform: translateY(-2px);
}
.stat-card .glow {
  position:absolute; top:-30px; right:-30px;
  width:90px; height:90px; border-radius:50%; filter:blur(40px); opacity:0.12;
  animation: float 6s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-5px, 5px); }
}
.stat-card .stat-icon {
  width:36px; height:36px; border-radius:var(--radius-sm);
  display:flex; align-items:center; justify-content:center; margin-bottom:10px;
}
.stat-card .stat-label { font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:1px; margin-bottom:4px; }
.stat-card .stat-value { font-family:'Bebas Neue',sans-serif; font-size:32px; letter-spacing:1px; }
.stat-card .stat-sub { font-size:11px; margin-top:2px; }

/* ── Staggered card entrance ─────────────────────────────── */
.stat-card { animation: staggerIn 0.4s ease both; }
.stat-card:nth-child(1) { animation-delay: 0ms; }
.stat-card:nth-child(2) { animation-delay: 50ms; }
.stat-card:nth-child(3) { animation-delay: 100ms; }
.stat-card:nth-child(4) { animation-delay: 150ms; }
@keyframes staggerIn {
  from { opacity:0; transform:translateY(12px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ── Section title ───────────────────────────────────────── */
.section-title {
  font-family:'Bebas Neue',sans-serif; font-size:22px; letter-spacing:2px;
  display:flex; align-items:center; gap:10px; margin-bottom:14px;
}
.section-title .dot { width:8px; height:8px; border-radius:50%; }

/* ── Day Table ───────────────────────────────────────────── */
.day-table {
  width:100%; border-collapse:separate; border-spacing:0;
  background:var(--bg-card); border:1px solid var(--border);
  border-radius:var(--radius); overflow:hidden; margin-bottom:24px;
}
.day-table thead th {
  padding:12px 14px; font-size:10px; color:var(--text-muted);
  text-transform:uppercase; letter-spacing:1.2px; text-align:left;
  background:var(--bg-input); border-bottom:1px solid var(--border); font-weight:500;
}
.day-table tbody tr { transition:all 0.2s; cursor:pointer; }
.day-table tbody tr:hover {
  background:var(--bg-card-hover);
  border-left: 2px solid var(--accent-green);
}
.day-table tbody tr.today-row {
  background:rgba(0,230,118,0.06);
  animation: todayPulse 3s ease-in-out infinite;
}
.day-table tbody tr.today-row:hover { background:rgba(0,230,118,0.1); }
@keyframes todayPulse {
  0%, 100% { background:rgba(0,230,118,0.06); }
  50%      { background:rgba(0,230,118,0.1); }
}
.day-table tbody td {
  padding:14px; border-bottom:1px solid var(--border); font-size:13px; vertical-align:middle;
}
.day-table tbody tr:last-child td { border-bottom:none; }

/* Day label */
.day-label-cell { display:flex; flex-direction:column; gap:2px; }
.day-label-cell .day-name { font-weight:600; font-size:14px; }
.day-label-cell .day-date { font-size:11px; color:var(--text-muted); }
.today-badge {
  display:inline-block; background:var(--accent-green); color:var(--bg-primary);
  font-size:9px; font-weight:700; padding:2px 7px; border-radius:50px;
  text-transform:uppercase; letter-spacing:1px; margin-left:6px;
}

/* Split badge */
.split-badge {
  display:inline-block; padding:4px 12px; border-radius:50px;
  font-size:11px; font-weight:600; white-space:nowrap;
}
.split-badge.s0 { background:var(--accent-blue-dim); color:var(--accent-blue); }
.split-badge.s1 { background:var(--accent-red-dim); color:var(--accent-red); }
.split-badge.s2 { background:var(--accent-orange-dim); color:var(--accent-orange); }
.split-badge.s3 { background:var(--accent-purple-dim); color:var(--accent-purple); }
.split-badge.rest { background:var(--bg-input); color:var(--text-muted); }

/* Day type badge */
.day-type-badge {
  display:inline-block; padding:2px 8px; border-radius:50px;
  font-size:9px; font-weight:700; text-transform:uppercase; letter-spacing:0.5px;
  margin-left:6px;
}
.day-type-badge.training { background:var(--accent-blue-dim); color:var(--accent-blue); }
.day-type-badge.rest-day { background:var(--bg-input); color:var(--text-muted); }

/* Meals preview */
.meal-preview { display:flex; flex-wrap:wrap; gap:4px; }
.meal-chip {
  font-size:11px; padding:3px 9px; border-radius:50px;
  background:var(--bg-input); color:var(--text-secondary);
  border:1px solid var(--border); white-space:nowrap;
}

/* Calorie bar */
.cal-bar-wrap { display:flex; align-items:center; gap:8px; }
.cal-bar { flex:1; height:6px; background:var(--bg-input); border-radius:3px; overflow:hidden; min-width:60px; }
.cal-bar-fill { height:100%; border-radius:3px; transition:width 0.5s ease; }
.cal-num { font-family:'Bebas Neue',sans-serif; font-size:18px; min-width:45px; }

/* Protein/Weight cells */
.protein-cell { font-weight:600; color:var(--accent-cyan); }
.weight-cell { font-family:'Bebas Neue',sans-serif; font-size:18px; }
.weight-change { font-size:11px; font-weight:400; }
.weight-change.up { color:var(--accent-green); }
.weight-change.down { color:var(--accent-red); }

/* Expand icon */
.expand-icon {
  width:24px; height:24px; border-radius:50%;
  background:var(--bg-input); display:flex; align-items:center; justify-content:center;
  transition:all 0.3s; color:var(--text-muted);
}
.day-table tbody tr:hover .expand-icon { background:var(--accent-green-dim); color:var(--accent-green); }

/* ── Day Detail Row (expanded) ───────────────────────────── */
.day-detail-row { display:none; }
.day-detail-row.open { display:table-row; }
.day-detail-row td { padding:0 !important; border-bottom:1px solid var(--border) !important; }
.day-detail-content {
  padding:20px 24px; background:var(--bg-input);
  display:grid; grid-template-columns:1fr 1fr; gap:20px;
  animation: fadeIn 0.3s ease;
}
.detail-section h4 {
  font-family:'Bebas Neue',sans-serif; font-size:16px; letter-spacing:1.5px;
  margin-bottom:10px; display:flex; align-items:center; gap:8px;
}
.detail-section h4 .dot { width:6px; height:6px; border-radius:50%; }

/* Detail meal items */
.detail-meal-item {
  display:flex; justify-content:space-between; align-items:center;
  padding:8px 12px; background:var(--bg-card); border:1px solid var(--border);
  border-radius:var(--radius-sm); margin-bottom:6px; transition:all 0.2s;
}
.detail-meal-item:hover { border-color:var(--accent-green); }
.detail-meal-item .dm-type { font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:1px; }
.detail-meal-item .dm-name { font-size:13px; font-weight:500; margin-top:1px; }
.detail-meal-item .dm-cals { font-family:'Bebas Neue',sans-serif; font-size:18px; color:var(--accent-green); }
.detail-meal-item .dm-protein { font-size:11px; color:var(--accent-cyan); }

/* Shuffle animation */
.shuffle-spin {
  animation: spin 0.5s ease;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(720deg); }
}
.shuffle-in {
  animation: shuffleIn 0.3s ease;
}
@keyframes shuffleIn {
  from { opacity:0; transform:scale(0.95); }
  to   { opacity:1; transform:scale(1); }
}

/* Detail exercise items */
.detail-exercise-item {
  display:flex; align-items:center; gap:12px;
  padding:8px 12px; background:var(--bg-card); border:1px solid var(--border);
  border-radius:var(--radius-sm); margin-bottom:6px;
}
.detail-exercise-item .de-name { flex:1; font-size:13px; font-weight:500; }
.detail-exercise-item .de-info {
  font-size:11px; padding:3px 9px; border-radius:50px; background:var(--bg-input); color:var(--text-secondary);
}

/* Modify/Shuffle buttons */
.btn-modify {
  margin-top:8px; padding:8px 16px; border:1px dashed var(--border);
  border-radius:var(--radius-sm); background:transparent; color:var(--text-muted);
  font-family:'DM Sans',sans-serif; font-size:12px; cursor:pointer; transition:all 0.2s; width:100%;
}
.btn-modify:hover { border-color:var(--accent-green); color:var(--accent-green); }
.btn-shuffle {
  margin-top:8px; padding:8px 16px; border:none; border-radius:var(--radius-sm);
  background:var(--accent-green-dim); color:var(--accent-green);
  font-family:'DM Sans',sans-serif; font-size:12px; font-weight:600;
  cursor:pointer; transition:all 0.2s; width:100%;
  display:flex; align-items:center; justify-content:center; gap:6px;
}
.btn-shuffle:hover { background:var(--accent-green); color:var(--bg-primary); }

/* ── Bottom Grid ─────────────────────────────────────────── */
.bottom-grid { display:grid; grid-template-columns:2fr 1fr; gap:20px; }
.card {
  background:var(--bg-card); border:1px solid var(--border);
  border-radius:var(--radius); padding:22px;
}
.card-title {
  font-family:'Bebas Neue',sans-serif; font-size:18px; letter-spacing:2px;
  margin-bottom:14px; display:flex; align-items:center; gap:8px;
}
.card-title .dot { width:8px; height:8px; border-radius:50%; }

/* ── Weight chart ────────────────────────────────────────── */
.weight-chart { width:100%; height:180px; position:relative; }
.weight-chart canvas { width:100%!important; height:100%!important; }
.weight-input-row { display:flex; gap:10px; align-items:center; margin-top:12px; }
.weight-input-row input {
  flex:1; background:var(--bg-input); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:10px 14px; color:var(--text-primary);
  font-family:'DM Sans',sans-serif; font-size:13px; outline:none; transition:border-color 0.2s;
}
.weight-input-row input:focus { border-color:var(--accent-green); }
.weight-input-row input::placeholder { color:var(--text-muted); }
.btn-green {
  background:var(--accent-green); border:none; color:var(--bg-primary);
  font-family:'DM Sans',sans-serif; font-weight:700; font-size:12px;
  padding:10px 20px; border-radius:var(--radius-sm); cursor:pointer; transition:all 0.2s; white-space:nowrap;
}
.btn-green:hover { filter:brightness(1.1); transform:translateY(-1px); }

/* ── Quick Actions ───────────────────────────────────────── */
.quick-actions { display:flex; flex-direction:column; gap:10px; }
.quick-action {
  padding:14px 16px; background:var(--bg-input); border:1px solid var(--border);
  border-radius:var(--radius-sm); cursor:pointer; transition:all 0.2s;
  display:flex; align-items:center; gap:12px;
}
.quick-action:hover { border-color:var(--accent-green); background:var(--bg-card-hover); }
.qa-icon { width:36px; height:36px; border-radius:var(--radius-sm); display:flex; align-items:center; justify-content:center; font-size:18px; }
.qa-label { font-weight:500; font-size:13px; }
.qa-sub { font-size:11px; color:var(--text-muted); }

/* ── History Page ────────────────────────────────────────── */
.history-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; }
.history-header h2 { font-family:'Bebas Neue',sans-serif; font-size:30px; letter-spacing:2px; }
.btn-back {
  display:flex; align-items:center; gap:6px;
  background:var(--bg-card); border:1px solid var(--border);
  padding:8px 18px; border-radius:50px; color:var(--text-secondary);
  font-family:'DM Sans',sans-serif; font-size:13px; font-weight:500;
  cursor:pointer; transition:all 0.2s;
}
.btn-back:hover { border-color:var(--accent-green); color:var(--accent-green); }
.history-week-selector { display:flex; gap:8px; margin-bottom:20px; overflow-x:auto; padding-bottom:4px; }
.week-tab {
  padding:8px 18px; border-radius:50px; border:1px solid var(--border);
  background:transparent; color:var(--text-secondary); font-family:'DM Sans',sans-serif;
  font-size:12px; font-weight:500; cursor:pointer; white-space:nowrap; transition:all 0.2s;
}
.week-tab:hover { border-color:var(--text-secondary); }
.week-tab.active { background:var(--accent-green); border-color:var(--accent-green); color:var(--bg-primary); font-weight:700; }
.history-charts { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:20px; }
.history-chart-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:20px; }
.history-chart-card .chart-area { width:100%; height:180px; position:relative; }
.history-chart-card .chart-area canvas { width:100%!important; height:100%!important; }
.history-summary { display:grid; grid-template-columns:repeat(5,1fr); gap:12px; margin-bottom:20px; }
.summary-mini { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-sm); padding:14px 16px; text-align:center; }
.summary-mini .sm-label { font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:1px; margin-bottom:4px; }
.summary-mini .sm-value { font-family:'Bebas Neue',sans-serif; font-size:26px; }
.full-table-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); overflow-x:auto; }
.full-table { width:100%; border-collapse:collapse; min-width:900px; }
.full-table thead th {
  padding:12px 10px; font-size:9px; color:var(--text-muted);
  text-transform:uppercase; letter-spacing:1px; text-align:left;
  background:var(--bg-input); border-bottom:1px solid var(--border); font-weight:500; white-space:nowrap;
}
.full-table tbody td { padding:11px 10px; border-bottom:1px solid var(--border); font-size:12px; }
.full-table tbody tr:last-child td { border-bottom:none; }
.full-table tbody tr:hover { background:var(--bg-card-hover); }

/* ── Modals ──────────────────────────────────────────────── */
.modal-overlay {
  display:none; position:fixed; inset:0; background:rgba(0,0,0,0.7);
  backdrop-filter:blur(8px); z-index:200; align-items:center; justify-content:center;
}
.modal-overlay.open { display:flex; }
.modal-overlay.closing { animation: backdropOut 0.25s ease forwards; }
@keyframes backdropOut { to { opacity:0; } }
.modal {
  background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius);
  padding:28px; width:90%; max-width:480px; box-shadow:var(--shadow); animation:modalIn 0.3s ease;
}
.modal-overlay.closing .modal { animation: modalOut 0.25s ease forwards; }
@keyframes modalIn { from{opacity:0;transform:scale(0.95)} to{opacity:1;transform:none} }
@keyframes modalOut { from{opacity:1;transform:scale(1)} to{opacity:0;transform:scale(0.95)} }
.modal h2 { font-family:'Bebas Neue',sans-serif; font-size:22px; letter-spacing:2px; margin-bottom:16px; }
.modal label { display:block; font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:1px; margin-bottom:5px; margin-top:12px; }
.modal input, .modal select {
  width:100%; background:var(--bg-input); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:10px 14px; color:var(--text-primary);
  font-family:'DM Sans',sans-serif; font-size:13px; outline:none;
}
.modal input:focus, .modal select:focus { border-color:var(--accent-green); }
.modal-actions { display:flex; gap:10px; margin-top:20px; }
.modal-actions button {
  flex:1; padding:11px; border-radius:var(--radius-sm); font-family:'DM Sans',sans-serif;
  font-size:13px; font-weight:600; cursor:pointer; border:none; transition:all 0.2s;
}
.btn-cancel { background:var(--bg-input); color:var(--text-secondary); }
.btn-cancel:hover { background:var(--bg-card-hover); }

/* ── Skeleton Loading ────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-card-hover) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width:1100px) {
  .stats-row { grid-template-columns:repeat(2,1fr); }
  .bottom-grid { grid-template-columns:1fr; }
  .history-charts { grid-template-columns:1fr; }
  .history-summary { grid-template-columns:repeat(3,1fr); }
  .day-detail-content { grid-template-columns:1fr; }
}
@media (max-width:700px) {
  .sidebar { width:56px; }
  .sidebar .logo { font-size:16px; }
  .main { margin-left:56px; padding:18px 14px; }
  .header h1 { font-size:26px; }
  .stats-row { grid-template-columns:1fr; }
  .history-summary { grid-template-columns:1fr 1fr; }
}
