:root {
  /* Core Colors */
  --bg-color: #0f1115;
  --surface-color: #1a1d24;
  --surface-hover: #232730;
  --text-primary: #f0f2f5;
  --text-secondary: #9ba1a6;

  /* Accents */
  --accent-color: #00ff88;
  --accent-hover: #00d672;
  --accent-secondary: #00d2ff;
  --accent-tertiary: #b760ff;

  /* Status */
  --status-low: #ff4757;
  --status-mid: #ffb142;
  --status-high: #00ff88;
  --status-elite: #00d2ff;

  /* Borders & Shadows */
  --border-color: rgba(255, 255, 255, 0.08);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 20px rgba(0, 255, 136, 0.15);

  /* Typography */
  --font-family:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  padding: 1rem;
}

/* Typography Helpers */
.badge {
  background: linear-gradient(
    135deg,
    var(--accent-tertiary),
    var(--accent-secondary)
  );
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 12px;
  vertical-align: super;
  font-weight: bold;
}

.text-accent {
  color: var(--accent-color);
}

/* Layout */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
}

.main-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 1024px) {
  .main-content {
    grid-template-columns: 350px 1fr;
  }
}

/* Card Styling */
.card {
  display: flex;
  flex-direction: column;
  background-color: var(--surface-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.card__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.card__header .card__title {
  margin-bottom: 0;
}

/* Dashboard Grid */
.results-dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.dashboard-row {
  align-items: stretch;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 1200px) {
  .dashboard-row {
    align-items: stretch;
    flex-direction: row;
  }
  .dashboard-col-large {
    flex: 2;
  }
  .dashboard-col-small {
    flex: 1;
    min-width: 0;
  }
  .dashboard-col-half {
    flex: 1;
  }
}

.is-hidden {
  display: none !important;
  opacity: 0;
}

/* Form Styles */
.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.form__group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.form__group--row {
  flex-direction: row;
  gap: 1rem;
}
.form__field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

input,
select {
  width: 100%;
  padding: 0.8rem;
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 2px rgba(0, 210, 255, 0.1);
}

.btn {
  padding: 1rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  margin-top: 0.5rem;
}

.btn--primary {
  background-color: var(--accent-color);
  color: #000;
}

.btn--primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

/* Unit Toggle */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.toggle-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.toggle-label.is-active {
  color: var(--accent-color);
  font-weight: bold;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--surface-hover);
  transition: 0.4s;
  border-radius: 22px;
  border: 1px solid var(--border-color);
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-secondary);
  transition: 0.4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: rgba(0, 210, 255, 0.1);
  border-color: var(--accent-secondary);
}
input:checked + .slider:before {
  transform: translateX(22px);
  background-color: var(--accent-secondary);
}

/* SVG Gauge Meter */
.score-container {
  flex: 1 1 0%;
  min-width: 250px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.score-top-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  justify-content: center;
}

@media (min-width: 600px) {
  .score-top-row {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }
}

.gauge-wrapper {
  position: relative;
  width: 250px;
  height: 125px;
  flex-shrink: 0;
}

.gauge {
  height: 100%;
  width: 100%;
  overflow: visible;
}

.gauge-bg {
  stroke: var(--border-color);
}

.gauge-fill {
  stroke: var(--status-mid); /* Default */
  transition:
    stroke-dashoffset 1.5s cubic-bezier(0.22, 1, 0.36, 1),
    stroke 0.5s ease;
  filter: drop-shadow(0 0 8px currentColor);
}

.gauge-content {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  transform: translateY(20%);
}

.gauge-value {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
}

.gauge-status {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: -5px;
}

/* Score Breakdown Reasons */
.score-breakdown {
  flex: 1;
  min-width: 200px;
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.score-breakdown h3 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.reasons-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.reasons-list li {
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.reason-pos {
  color: var(--status-high);
  font-weight: bold;
}
.reason-neg {
  color: var(--status-low);
  font-weight: bold;
}
.reason-neu {
  color: var(--status-mid);
  font-weight: bold;
}

/* Metrics Table */
.table-container {
  overflow-x: auto;
}

.metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.metrics-table th {
  text-align: left;
  padding: 0.75rem 0.5rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  font-weight: 500;
}

.metrics-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.metrics-table tr:last-child td {
  border-bottom: none;
}
.metrics-table td:first-child {
  color: var(--text-secondary);
  font-weight: 500;
}
.metrics-table td:nth-child(3) {
  color: var(--accent-secondary);
}

.target-note {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 1rem;
  font-style: italic;
}

/* Chart Container */
.chart-wrapper {
  flex: 1 1 0%;
  min-width: 250px;
  position: relative;
  height: 250px;
  width: 100%;
}

.chart-raw-data {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
}

.raw-data-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.raw-data-item span {
  font-size: 1rem;
  font-weight: bold;
  color: var(--text-primary);
}

/* Macros & Foods */
.macro-container {
  flex: 1 1 0%;
  min-width: 250px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.macro-header {
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--border-color);
}

.macro-header span {
  color: var(--accent-color);
  font-size: 1.4rem;
}

.macro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.macro-box {
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.macro-box h4 {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.macro-box h4 .grams {
  color: #fff;
  font-weight: 700;
}
.protein-title {
  color: #ff6b6b;
}
.carb-title {
  color: #4facfe;
}
.fat-title {
  color: #feca57;
}

.food-list {
  list-style: none;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.food-list li {
  padding-left: 12px;
  position: relative;
}

.food-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: currentColor;
}

/* Tabs for Meals */
.tabs {
  display: flex;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.4rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.is-active {
  background: var(--surface-hover);
  color: var(--accent-color);
  box-shadow: var(--shadow-sm);
}

.tab-content {
  flex: 1 1 0%;
  min-width: 250px;
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: pre-line;
  line-height: 1.7;
}

.suggestion-content {
  flex: 1 1 0%;
  min-width: 250px;
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: pre-line;
  line-height: 1.7;
}
.bmi-chart-wrapper {
  max-width: 100%;
  overflow: hidden;
  position: relative;
  width: 100%;
  height: 250px;
  /* Flex isn't strictly necessary here if parent is col, but harmless */
  flex: 1 1 0%;
  min-width: 0;
}
