/* pulsePlan Main Stylesheet */

/* --- 1. CSS Variables & Theming --- */
:root {
  /* Dark mode (default) */
  --bg: #0d1117;
  --panel: #161b22;
  --card: #21262d;
  --line: #30363d;
  --line-strong: #484f58;

  --text: #c9d1d9;
  --text-soft: #8b949e;

  /* Brand accents */
  --cyan: #58a6ff;
  --orange: #d18616;
  --lime: #3fb950;
  --pink: #ff7b72;
  --purple: #8957e5;

  /* Layout vars */
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.3);
  --transition: 0.3s ease;
}

/* Light mode overrides */
body.light-theme {
  --bg: #f6f8fa;
  --panel: #ffffff;
  --card: #f3f4f6;
  --line: #d0d7de;
  --line-strong: #afb8c1;

  --text: #24292f;
  --text-soft: #57606a;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* --- 2. Normalize / Base setup --- */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: "Outfit", sans-serif;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

/* Typography styles */
h1,
h2,
h3,
h4 {
  font-family: "Space Grotesk", sans-serif;
  margin: 0;
}

p {
  line-height: 1.5;
}

.eyebrow,
.sidebar-label,
.section-kicker,
.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  margin-bottom: 5px;
}

.muted-text,
.card-meta {
  color: var(--text-soft);
  font-size: 0.9rem;
}

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

.sidebar {
  width: 280px;
  background-color: var(--panel);
  border-right: 1px solid var(--line);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
}

.main-panel {
  flex-grow: 1;
  padding: 30px;
  max-width: 1200px;
  margin: 0 auto;
}

/* --- 4. Sidebar Elements --- */
.brand-block {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 40px;
}

.brand-mark {
  background-color: var(--cyan);
  color: #fff;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  font-size: 1.2rem;
}

/* Nav links */
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 40px;
}

.nav-link {
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  transition: all var(--transition);
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.nav-link.active {
  background-color: rgba(88, 166, 255, 0.1);
  color: var(--cyan);
  font-weight: 500;
}

body.light-theme .nav-link:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Sidebar cards */
.sidebar-card {
  background-color: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.intensity-ring {
  background-color: rgba(0, 0, 0, 0.2);
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 15px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid var(--purple);
}

.intensity-core {
  text-align: center;
}

.intensity-core strong {
  font-size: 1.5rem;
  display: block;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* --- 5. Main Content Area --- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--card);
  padding: 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 30px;
  border: 1px solid var(--line);
}

.topbar-actions {
  display: flex;
  gap: 15px;
}

/* Buttons */
.secondary-button,
.primary-button,
.ghost-button {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.primary-button {
  background-color: var(--cyan);
  color: #000;
  font-weight: bold;
}

.primary-button:hover {
  background-color: #438be5;
}

.secondary-button {
  background-color: rgba(88, 166, 255, 0.15);
  color: var(--cyan);
}

.secondary-button:hover {
  background-color: rgba(88, 166, 255, 0.25);
}

.ghost-button {
  border: 1px solid var(--line-strong);
  color: var(--text);
}

.ghost-button:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

body.light-theme .ghost-button:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.subtle-danger {
  background-color: var(--pink);
  color: #fff;
}

.subtle-danger:hover {
  background-color: #d15651;
}

/* Sections toggling */
.page-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.page-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hero Section */
.hero-panel {
  display: flex;
  background: linear-gradient(135deg, var(--panel), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px;
  margin-bottom: 30px;
}

.hero-copy p {
  max-width: 60ch;
}

.hero-copy h3 {
  font-size: 2rem;
  margin: 10px 0;
}

.hero-pills,
.inline-chips,
.session-tags,
.goal-meta-row,
.session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 15px;
}

.pill,
.head-chip,
.tiny-chip,
.mini-badge {
  background-color: rgba(0, 0, 0, 0.2);
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  color: var(--text-soft);
}

.tiny-chip.success,
.mini-badge.success {
  border-color: var(--lime);
  color: var(--lime);
}

.mini-badge.highlight {
  border-color: var(--cyan);
  color: var(--cyan);
}

.mini-badge.warning {
  border-color: var(--orange);
  color: var(--orange);
}

.hero-visual {
  flex-grow: 1;
  display: flex;
  justify-content: flex-end;
}

.summary-stack {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.glass-card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 15px;
  border-radius: var(--radius-md);
}

.glass-card strong {
  font-size: 1.4rem;
}

/* Grids */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.dashboard-layout,
.two-column-layout {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.three-column-layout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card,
.panel-card {
  background-color: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
}

.stat-card strong,
.macro-card strong,
.calculator-output strong,
.session-card strong,
.goal-card strong,
.insight-card strong {
  display: block;
  font-size: 1.8rem;
  margin: 10px 0 5px;
}

.session-card strong,
.goal-card strong,
.insight-card strong {
  font-size: 1.2rem;
  margin: 0 0 5px 0;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

/* --- 6. Charts & Visuals --- */
.bar-chart {
  display: flex;
  align-items: flex-end;
  height: 200px;
  gap: 10px;
  margin-top: 20px;
}

.bar-chart__item {
  flex-grow: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.bar-chart__bar-wrap {
  flex-grow: 1;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  position: relative;
  display: flex;
  align-items: flex-end;
}

body.light-theme .bar-chart__bar-wrap {
  background-color: rgba(0, 0, 0, 0.05);
}

.bar-chart__bar {
  background-color: var(--cyan);
  width: 100%;
  border-radius: 4px;
}

.progress-ring-grid {
  display: flex;
  justify-content: space-between;
}

.ring-card {
  text-align: center;
  padding: 10px;
}

.progress-ring {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: conic-gradient(var(--cyan) var(--fill, 0%), var(--line) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
}

.progress-ring[data-ring="water"] {
  background: conic-gradient(var(--orange) var(--fill, 0%), var(--line) 0);
}

.progress-ring[data-ring="protein"] {
  background: conic-gradient(var(--lime) var(--fill, 0%), var(--line) 0);
}

.progress-ring__value {
  background-color: var(--card);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Basic lists */
.stack-list,
.insight-list,
.session-list,
.timeline-list,
.goal-list,
.tip-stack,
.chip-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chip-grid {
  flex-direction: row;
  flex-wrap: wrap;
}

.list-card,
.insight-card,
.session-card,
.timeline-card,
.goal-card,
.tip-card {
  background-color: var(--panel);
  border: 1px solid var(--line);
  padding: 15px;
  border-radius: var(--radius-sm);
}

.session-top,
.goal-top,
.session-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.session-actions button,
.goal-actions button {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  margin-right: 5px;
}

.session-actions button:hover,
.goal-actions button:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

body.light-theme .session-actions button:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-soft);
}

input,
select,
textarea {
  padding: 10px;
  background-color: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--cyan);
}

/* Macros */
.macro-summary-grid {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
}

.macro-card {
  text-align: center;
}

.macro-bars {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.macro-bar__track {
  background-color: var(--line);
  height: 10px;
  border-radius: 5px;
}

.macro-bar__fill {
  background-color: var(--cyan);
  height: 100%;
  border-radius: 5px;
}

.macro-bar__fill.protein {
  background-color: var(--lime);
}

.macro-bar__fill.carbs {
  background-color: var(--cyan);
}

.macro-bar__fill.fats {
  background-color: var(--orange);
}

/* Timeline & Meters */
.hydration-meter {
  height: 200px;
  background-color: var(--line);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  margin-top: 20px;
}

.hydration-fill {
  position: absolute;
  bottom: 0;
  width: 100%;
  background-color: var(--cyan);
  transition: height 0.3s ease;
}

.hydration-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  color: #fff;
}

/* Goal progress */
.goal-progress {
  height: 8px;
  background-color: var(--line);
  border-radius: 4px;
  margin: 10px 0;
}

.goal-progress__fill {
  height: 100%;
  background-color: var(--purple);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Line Chart */
.line-chart {
  display: flex;
  height: 150px;
  align-items: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.line-chart__point-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.line-chart__line {
  background-color: var(--cyan);
  width: 2px;
}

.line-chart__dot {
  width: 10px;
  height: 10px;
  background-color: var(--cyan);
  border-radius: 50%;
  margin-top: -5px;
}

.calculator-output {
  margin-top: 20px;
  padding: 20px;
  background-color: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.footer-note {
  margin-top: 30px;
  padding: 20px;
  text-align: center;
  color: var(--text-soft);
  border-top: 1px solid var(--line);
}

.empty-state {
  padding: 20px;
  text-align: center;
  color: var(--text-soft);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}

.toast {
  background-color: var(--panel);
  border: 1px solid var(--line);
  padding: 15px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 250px;
}

.toast.success {
  border-left: 4px solid var(--lime);
}

.toast.error {
  border-left: 4px solid var(--pink);
}

/* Helpers */
.quick-water-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 20px 0;
}

.tip-stack p {
  margin-top: 5px;
}

@media (max-width: 1024px) {
  .sidebar {
    width: 220px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .three-column-layout {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .dashboard-layout,
  .two-column-layout,
  .three-column-layout,
  .stats-grid {
    grid-template-columns: 1fr;
  }
}