/* Calory — Cards, Stats, Charts, Meal Items */

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color var(--transition-fast) ease, transform var(--transition-fast) ease;
}

.card:hover {
  border-color: var(--border-accent);
}

.card:active {
  transform: scale(0.985);
}

.card-title {
  font-family: 'Ubuntu Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.card-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* Day card */
.day-item {
  cursor: pointer;
}

.day-item:hover {
  border-color: var(--border-accent);
}

.day-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.day-item-kcal {
  font-family: 'Aakar', Georgia, 'Times New Roman', serif;
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}

.day-item-kcal-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  text-align: center;
  transition: border-color var(--transition-fast) ease;
}

.stat-val {
  font-family: 'Aakar', Georgia, 'Times New Roman', serif;
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.1;
}

.stat-val.accent {
  color: var(--accent);
}

.stat-val.accent2 {
  color: var(--accent2);
}

.stat-val.green {
  color: var(--green);
}

.stat-val.orange {
  color: var(--orange);
}

.stat-val.violet {
  color: var(--violet);
}

.stat-lbl {
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
  line-height: 1.2;
}

/* Calorie ring */
.calorie-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  margin-bottom: 16px;
}

.calorie-ring-svg {
  width: 140px;
  height: 140px;
  transform: rotate(-90deg);
}

.calorie-ring-bg {
  fill: none;
  stroke: var(--surface2);
  stroke-width: 7;
}

.calorie-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--ring-fill) var(--ease-out),
              stroke var(--transition-fast) ease;
}

.calorie-ring-fill.orange {
  stroke: var(--orange);
}

.calorie-ring-fill.red {
  stroke: var(--red);
}

.calorie-ring-fill.green {
  stroke: var(--green);
}

.calorie-ring-center {
  position: absolute;
  text-align: center;
  pointer-events: none;
}

.calorie-ring-center[data-ring] {
  position: relative;
}

/* Macro bars (for dashboard / day detail) */
.macro-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.macro-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.macro-bar-label {
  width: 48px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.macro-bar-track {
  flex: 1;
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}

.macro-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 600ms var(--ease-out);
  min-width: 2px;
}

.macro-bar-fill.green {
  background: var(--green);
}

.macro-bar-fill.accent {
  background: var(--accent);
}

.macro-bar-fill.orange {
  background: var(--orange);
}

.macro-bar-value {
  width: 52px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* Bar chart (weekly view) */
.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  margin-bottom: 16px;
}

.chart-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.chart-bar-row:last-child {
  margin-bottom: 0;
}

.chart-bar-label {
  width: 36px;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.chart-bar-track {
  flex: 1;
  height: 20px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 500ms var(--ease-out);
  min-width: 2px;
}

.chart-bar-fill.trend-up {
  background: var(--accent);
}

.chart-bar-fill.trend-down {
  background: var(--green);
}

.chart-bar-fill.trend-neutral {
  background: var(--text-muted);
  opacity: 0.4;
}

.chart-bar-val {
  width: 48px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-sub);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* Meal items */
.meal-section {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 16px;
}

.meal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast) ease;
}

.meal-item:last-child {
  border-bottom: none;
}

.meal-item:hover {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding-left: 8px;
  padding-right: 8px;
  margin-left: -8px;
  margin-right: -8px;
}

.meal-info {
  flex: 1;
  min-width: 0;
}

.meal-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meal-macros {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.meal-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.meal-kcal {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: right;
}

.meal-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  opacity: 0.4;
  transition: opacity var(--transition-fast) ease, background var(--transition-fast) ease;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
}

.meal-btn:hover {
  opacity: 0.8;
  background: var(--surface3);
}

.meal-btn:active {
  transform: scale(0.9);
}

.meal-btn.delete {
  color: var(--red);
}

.meal-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.meal-total {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.meal-total-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.meal-total-value {
  font-family: 'Aakar', Georgia, 'Times New Roman', serif;
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}

.meal-total-macros {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* Day card macro sub-items — used on every day card across dashboard, weekly, history */
.day-macro {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 56px;
}

.day-macro .val {
  font-family: 'Aakar', Georgia, 'Times New Roman', serif;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}

.day-macro .lbl {
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
}

/* --- Hero Section --- */

.hero-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 20px;
}

.hero-remaining {
  font-family: 'Aakar', Georgia, 'Times New Roman', serif;
  font-size: 3rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.02em;
  transition: color var(--transition-fast) ease;
}

.hero-remaining.over {
  color: var(--red);
}

.hero-label {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.hero-tri-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 300px;
}

.hero-tri-col {
  flex: 1;
  text-align: center;
}

.hero-tri-val {
  font-family: 'Aakar', Georgia, 'Times New Roman', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.1;
}

.hero-tri-lbl {
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.hero-tri-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
}

/* --- Profile Page --- */

.profile-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
}

.profile-name {
  font-family: 'Aakar', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.profile-target {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 6px;
}

.profile-target-value {
  font-family: 'Aakar', Georgia, serif;
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
  margin-top: 8px;
}

.profile-macros-title {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.profile-macro-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.profile-macro-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 8px;
  text-align: center;
}

.profile-macro-val {
  font-family: 'Aakar', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.1;
}

.profile-macro-lbl {
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

/* --- Meal Section Cards --- */

.meals-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  margin-top: 8px;
}

.meals-section-header .page-title {
  font-size: 1rem;
}

.meals-expand-all {
  font-size: 0.6875rem;
  color: var(--accent);
  cursor: pointer;
  background: none;
  border: none;
  font-weight: 600;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast) ease;
}

.meals-expand-all:hover {
  background: var(--accent-dim);
}

.meal-section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color var(--transition-fast) ease;
}

.meal-section-card:hover {
  border-color: var(--border-strong);
}

.meal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  transition: background var(--transition-fast) ease;
  user-select: none;
}

.meal-card-header:active {
  background: var(--hover-bg);
}

.meal-card-type-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.meal-type-label {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  background: var(--surface2);
  border-radius: 3px;
}

.meal-type-label.breakfast {
  color: var(--orange);
  background: var(--orange-bg);
}

.meal-type-label.lunch {
  color: var(--accent);
  background: var(--accent-bg);
}

.meal-type-label.dinner {
  color: var(--violet);
  background: var(--violet-bg);
}

.meal-type-label.snack {
  color: var(--green);
  background: var(--green-bg);
}

.meal-type-label.other {
  color: var(--text-sub);
  background: var(--surface2);
}

.meal-card-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.meal-card-kcal {
  font-family: 'Aakar', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}

.meal-card-item-count {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.meal-card-chevron {
  width: 16px;
  height: 16px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
  transition: transform var(--transition-fast) ease;
  margin-left: 8px;
}

.meal-section-card.expanded .meal-card-chevron {
  transform: rotate(180deg);
}

.meal-card-items {
  display: none;
  border-top: 1px solid var(--border);
  padding: 8px 0;
}

.meal-section-card.expanded .meal-card-items {
  display: block;
}

.meal-card-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  transition: background var(--transition-fast) ease;
}

.meal-card-item:hover {
  background: var(--hover-bg);
}

.meal-card-item-info {
  flex: 1;
  min-width: 0;
}

.meal-card-item-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meal-card-item-grams {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.meal-card-item-kcal {
  font-family: 'Aakar', Georgia, serif;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-sub);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: right;
}
