﻿:root {
  --bg: #0e0e10;
  --surface: #16161a;
  --surface-2: #1f1f24;
  --surface-3: #2a2a31;
  --border: #2e2e36;
  --text: #ffffff;
  --text-muted: #b4b4be;
  --text-dim: #787885;

  --emerald: #f4254c;
  --emerald-soft: rgba(244, 37, 76, 0.16);
  --sky: #f4f4f5;
  --sky-soft: rgba(255, 255, 255, 0.12);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.15);
  --rose: #fb7185;
  --rose-soft: rgba(251, 113, 133, 0.14);
  --violet: #a78bfa;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100dvh;
}

.app-shell {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: calc(2rem + env(safe-area-inset-bottom));
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(14, 14, 16, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: calc(0.75rem + env(safe-area-inset-top)) 1rem 0.65rem;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--emerald-soft);
  border: 1px solid rgba(244, 37, 76, 0.4);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
}

.brand-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-sub {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.beer-pill, .info-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.beer-pill {
  border-color: rgba(245, 158, 11, 0.4);
  background: var(--amber-soft);
  color: #fcd34d;
}

.beer-pill:active, .info-pill:active {
  transform: scale(0.96);
}

/* Main Tabs */
.main-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  background: var(--surface);
  padding: 0.25rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.tab-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem 0.75rem;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.tab-badge {
  background: var(--emerald);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
}

/* Views */
.view-section {
  padding: 0.85rem 1rem 1rem;
}

.view-section[hidden] {
  display: none;
}

/* Day Selector */
.day-strip-wrapper {
  margin: 0 -1rem 0.9rem;
  padding: 0 1rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.day-strip-wrapper::-webkit-scrollbar {
  display: none;
}

.day-strip {
  display: flex;
  gap: 0.5rem;
  min-width: max-content;
}

.day-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 13px;
  padding: 0.5rem 0.75rem;
  min-width: 88px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  transition: all 0.18s ease;
}

.day-chip-name {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.day-chip-tag {
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.9;
}

.day-chip-progress {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.day-chip.active {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--emerald);
  box-shadow: 0 0 0 1px var(--emerald);
}

.day-chip.type-strength.active {
  border-color: var(--sky);
  box-shadow: 0 0 0 1px var(--sky);
}

.day-chip.type-rest.active {
  border-color: var(--amber);
  box-shadow: 0 0 0 1px var(--amber);
}

/* Summary Card */
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.9rem;
  box-shadow: var(--shadow);
}

.summary-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.day-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.training-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}

.badge-mtb {
  background: var(--emerald-soft);
  color: #ff5c7c;
}

.badge-strength {
  background: var(--sky-soft);
  color: #ffffff;
}

.badge-rest {
  background: var(--amber-soft);
  color: #fcd34d;
}

.day-completion {
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.day-completion strong {
  display: block;
  font-size: 1.05rem;
  color: var(--text);
}

.strategy-note {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--emerald);
}

.macro-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
}

.macro-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.55rem 0.5rem;
  text-align: center;
}

.macro-label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.macro-value {
  display: block;
  font-size: 0.98rem;
  font-weight: 700;
  margin: 0.12rem 0;
}

.macro-target {
  display: block;
  font-size: 0.67rem;
  color: var(--text-dim);
}

.macro-bar {
  height: 4px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.35rem;
}

.macro-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Beer Section */
.beer-section {
  margin-bottom: 0.9rem;
}

.beer-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(22, 22, 26, 0.96));
  border: 1px solid rgba(245, 158, 11, 0.38);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.beer-card-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.beer-card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fde68a;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.beer-card-sub {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.beer-pairing {
  background: rgba(14, 14, 16, 0.65);
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
  color: #fef3c7;
}

.beer-check-btn {
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: var(--surface-2);
  color: #fde68a;
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.beer-check-btn.checked {
  background: var(--amber);
  color: #1f1300;
  border-color: var(--amber);
}

/* Meal Cards */
.meals-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.meal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.95rem;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

.meal-card.completed {
  border-color: rgba(244, 37, 76, 0.45);
  background: linear-gradient(180deg, rgba(244, 37, 76, 0.08), var(--surface));
}

.meal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.meal-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.meal-slot {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--emerald);
}

.meal-time-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 0.12rem 0.48rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.meal-title {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  font-weight: 700;
}

.meal-card.completed .meal-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.meal-check {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 0.95rem;
  font-weight: 700;
  transition: all 0.15s ease;
}

.meal-check.checked {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #ffffff;
}

.meal-prep {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ingredients-list {
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ingredients-list li {
  font-size: 0.86rem;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.ingredients-list li::before {
  content: "•";
  color: var(--emerald);
  font-weight: 700;
}

.meal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.meal-macros {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.macro-chip {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-muted);
}

.macro-chip.kcal {
  color: var(--text);
  background: var(--surface-3);
}

.macro-chip.prot {
  color: #ff5c7c;
  background: var(--emerald-soft);
}

.swap-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--sky);
  border-radius: 9px;
  padding: 0.38rem 0.72rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.15s ease;
}

.swap-btn:hover {
  background: var(--surface-3);
}

/* Shopping List */
.shopping-header-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.9rem;
}

.shopping-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.shopping-header-top h2 {
  margin: 0;
  font-size: 1.15rem;
}

.muted-text {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-ghost-sm {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 0.38rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.shopping-progress-bar {
  height: 7px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.shopping-progress-fill {
  height: 100%;
  background: var(--emerald);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.shopping-stats {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.shopping-categories {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.shop-cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.shop-cat-header {
  background: var(--surface-2);
  padding: 0.65rem 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.shop-cat-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.shop-cat-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.shop-items-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
}

.shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.95rem;
  border-bottom: 1px solid rgba(38, 54, 72, 0.55);
  cursor: pointer;
}

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

.shop-item-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.shop-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: transparent;
  flex-shrink: 0;
}

.shop-item.checked .shop-checkbox {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #ffffff;
}

.shop-item.checked .shop-item-name {
  text-decoration: line-through;
  color: var(--text-dim);
}

.shop-item-name {
  font-size: 0.88rem;
  font-weight: 500;
}

.shop-item-qty {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--emerald);
  white-space: nowrap;
}

.shop-item.checked .shop-item-qty {
  color: var(--text-dim);
}

/* Footer */
.app-footer {
  margin: 1.5rem 1rem 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.footer-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 0.4rem 0.72rem;
  font-size: 0.76rem;
  cursor: pointer;
}

.footer-btn-danger {
  color: var(--rose);
  border-color: rgba(251, 113, 133, 0.3);
}

.footer-note {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-sheet {
  width: 100%;
  max-width: 680px;
  max-height: 85dvh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s ease-out;
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 1rem;
  }
  .modal-sheet {
    border-radius: 20px;
  }
}

@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

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

.modal-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--emerald);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-title {
  margin: 0.1rem 0 0;
  font-size: 1.08rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
}

.modal-body {
  padding: 1rem 1.15rem calc(1.25rem + env(safe-area-inset-bottom));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-card {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 0.85rem;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: border-color 0.15s ease;
}

.option-card.selected {
  border-color: var(--emerald);
  box-shadow: 0 0 0 1px var(--emerald);
  background: rgba(244, 37, 76, 0.1);
}

.option-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.option-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.option-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--emerald);
  color: #ffffff;
}

.option-prep {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 0.45rem;
}

.option-ings {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.55rem;
}

.strategy-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
}

.strategy-block h4 {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
}

.strategy-block p, .strategy-block li {
  margin: 0.25rem 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.strategy-block ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
}

.modal-beer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.modal-beer-btn {
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 0.5rem 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.modal-beer-btn.checked {
  background: var(--amber);
  color: #1f1300;
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(1.25rem + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid var(--emerald);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  z-index: 80;
  box-shadow: var(--shadow);
}
