/* ============================================================
   MCM Touch Web — Design System
   Brand colors mirror the iOS app's asset catalog exactly.
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --primary:      #1A6B2A;
  --primary-dark: #145522;
  --leaf:         #4CAF2A;
  --amber:        #C8921A;
  --amber-light:  #f5f0e8;
  --bg:           #F5F4EE;
  --surface:      #FFFFFF;
  --text:         #1A3D1A;
  --text-muted:   #57606a;
  --border:       #e5e7eb;
  --red:          #dc2626;
  --green:        #16a34a;
  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    16px;
  --shadow:       0 1px 4px rgba(0,0,0,.08);
  --shadow-md:    0 4px 16px rgba(0,0,0,.10);
  --transition:   .18s ease;
  --nav-h:        64px;
  --sidebar-w:    240px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }

/* ── Typography ─────────────────────────────────────────────── */
h1 { font-size: 2rem;   font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.15rem;font-weight: 600; }
h4 { font-size: 1rem;   font-weight: 600; }
p  { color: var(--text-muted); }
small { font-size: .8rem; color: var(--text-muted); }

/* ── Layout ─────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: calc(var(--nav-h) + 32px) 32px 32px;
  max-width: 960px;
}
.page-header {
  margin-bottom: 28px;
}
.page-header h1 { color: var(--text); }
.page-header p  { margin-top: 6px; font-size: .95rem; }

/* ── Top Nav ─────────────────────────────────────────────────── */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
  gap: 16px;
}
.topnav .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  line-height: 1;
}
.topnav .brand:hover { text-decoration: none; }
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.brand-mcm {
  font-size: .95rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: .02em;
}
.brand-touch {
  font-size: .78rem;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: .01em;
}
.topnav .spacer { flex: 1; }
.topnav .nav-actions { display: flex; align-items: center; gap: 12px; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--nav-h));
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  overflow-y: auto;
  z-index: 90;
}
.sidebar .nav-section { margin-bottom: 8px; }
.sidebar .nav-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: 8px 12px 4px;
}
.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .95rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.sidebar .nav-item:hover { background: var(--bg); text-decoration: none; }
.sidebar .nav-item.active {
  background: rgba(26,107,42,.1);
  color: var(--primary);
  font-weight: 600;
}
.sidebar .nav-item .icon { width: 20px; text-align: center; font-size: 1.1rem; }

/* Auth-only pages — full-screen centred layout */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  border: none;
  transition: background var(--transition), opacity var(--transition), transform var(--transition);
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-amber { background: var(--amber); color: #fff; }
.btn-amber:hover { background: #a87515; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: rgba(26,107,42,.07); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--border); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-block { width: 100%; }
.btn-lg { padding: 13px 24px; font-size: 1rem; }
.btn-sm { padding: 6px 14px; font-size: .85rem; }

/* ── Form Elements ───────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-label .req { color: var(--red); margin-left: 2px; }
.form-control {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,107,42,.15);
}
.form-control.is-invalid { border-color: var(--red); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .85rem; color: var(--red); margin-top: 4px; display: none; }
.form-error.show { display: block; }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2357606a' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* ── Alerts & Banners ────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-warning { background: var(--amber-light); border: 1px solid #fcd34d; color: #92400e; }
.alert-info    { background: rgba(26,107,42,.07); border: 1px solid rgba(26,107,42,.2); color: var(--primary); }
.alert.hidden { display: none; }

/* ── Badges / Status Chips ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
}
.badge-pending   { background: rgba(200,146,26,.15); color: var(--amber); }
.badge-success   { background: rgba(22,163,74,.12);  color: #166534; }
.badge-danger    { background: rgba(185,28,28,.1);   color: #991b1b; }
.badge-confirmed { background: rgba(22,163,74,.15);  color: var(--green); }
.badge-cancelled { background: rgba(220,38,38,.12);  color: var(--red); }
.badge-primary   { background: rgba(26,107,42,.12);  color: var(--primary); }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text); background: var(--bg); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 24px;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-md);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 1.15rem; }
.modal-close {
  background: none; border: none;
  font-size: 1.3rem; color: var(--text-muted);
  padding: 4px; border-radius: 4px;
}
.modal-close:hover { background: var(--border); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── Loading Spinner ─────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
.spinner.dark {
  border-color: rgba(26,107,42,.2);
  border-top-color: var(--primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 16px; opacity: .35; }
.empty-state h3 { color: var(--text); margin-bottom: 8px; }

/* ── Section Header ──────────────────────────────────────────── */
.section-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 12px;
  margin-top: 28px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ── Utility ─────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted  { color: var(--text-muted); }
.text-primary{ color: var(--primary); }
.text-amber  { color: var(--amber); }
.text-red    { color: var(--red); }
.text-sm     { font-size: .875rem; }
.text-xs     { font-size: .8rem; }
.fw-600      { font-weight: 600; }
.hidden      { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); transition: transform var(--transition); }
  .sidebar.open { transform: translateX(0); width: 260px; box-shadow: var(--shadow-md); }
  .main-content { margin-left: 0; padding: calc(var(--nav-h) + 16px) 16px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .topnav .menu-toggle { display: flex; }
}
.menu-toggle {
  display: none;
  background: none; border: none;
  font-size: 1.4rem; color: var(--text);
  padding: 4px 8px;
}

/* ── Auth Card ───────────────────────────────────────────────── */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-md);
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo h1 { color: var(--primary); font-size: 1.6rem; margin-top: 10px; }
.auth-logo p  { font-size: .9rem; margin-top: 4px; }
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1; text-align: center;
  padding: 10px;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-muted);
  background: none; border: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
}
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.auth-form { display: none; }
.auth-form.active { display: block; }

/* ── Calendar ────────────────────────────────────────────────── */
.calendar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.cal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.cal-header h4 { font-size: 1rem; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day-label {
  text-align: center;
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 0;
  text-transform: uppercase;
}
.cal-day {
  text-align: center;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  cursor: default;
  position: relative;
  transition: background var(--transition);
  min-height: 38px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
}
.cal-day.available { cursor: pointer; font-weight: 600; }
.cal-day.available:hover { background: rgba(26,107,42,.1); }
.cal-day.selected { background: var(--primary); color: #fff; }
.cal-day.today:not(.selected) { background: rgba(26,107,42,.1); border: 1px solid rgba(26,107,42,.3); }
.cal-day.past, .cal-day.unavailable { color: #ccc; }
.cal-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--amber);
}
.cal-day.selected .cal-dot { background: rgba(255,255,255,.7); }

/* ── Time Slots ──────────────────────────────────────────────── */
.slots-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.slot-chip {
  padding: 8px 18px;
  border-radius: 20px;
  font-size: .88rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.slot-chip:hover { border-color: var(--primary); color: var(--primary); }
.slot-chip.selected { background: var(--amber); border-color: var(--amber); color: #fff; }

/* ── Product Card ────────────────────────────────────────────── */
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow var(--transition);
  cursor: pointer;
}
.product-card:hover { box-shadow: var(--shadow-md); }
.product-thumb {
  height: 110px;
  background: rgba(26,107,42,.07);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  color: rgba(26,107,42,.4);
  margin-bottom: 4px;
}
.product-name  { font-weight: 600; font-size: .95rem; }
.product-price { color: var(--amber); font-weight: 700; font-size: 1rem; }
.product-cat   { font-size: .78rem; color: var(--primary); background: rgba(26,107,42,.08); padding: 2px 8px; border-radius: 20px; display: inline-block; }

/* ── Cart Sidebar ────────────────────────────────────────────── */
.cart-drawer {
  position: fixed;
  top: var(--nav-h); right: 0;
  width: 340px;
  height: calc(100vh - var(--nav-h));
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition);
  z-index: 150;
}
.cart-drawer.open { transform: translateX(0); }
.cart-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.cart-items { flex: 1; overflow-y: auto; padding: 12px 20px; }
.cart-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: none; }
.cart-item-info { flex: 1; }
.cart-item-name  { font-weight: 600; font-size: .9rem; }
.cart-item-price { font-size: .85rem; color: var(--text-muted); }
.qty-ctrl { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.qty-btn:hover { background: var(--border); }
.qty-num { font-weight: 600; min-width: 20px; text-align: center; }
.cart-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.cart-total { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 12px; font-size: 1.05rem; }

/* ── Health Tracker ──────────────────────────────────────────── */
.tracker-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.tracker-label { font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 12px; }
.step-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(26,107,42,.1);
  color: var(--primary);
  font-size: 1.2rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.step-btn:hover { background: rgba(26,107,42,.2); }
.step-val { font-weight: 700; min-width: 40px; text-align: center; font-size: 1rem; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.toggle-switch { position: relative; width: 46px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #ccc;
  border-radius: 26px;
  transition: background var(--transition);
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
.mood-picker { display: flex; gap: 8px; }
.mood-btn {
  flex: 1; text-align: center;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bg);
  cursor: pointer;
  font-size: 1.4rem;
  transition: background var(--transition);
}
.mood-btn:hover  { background: var(--border); }
.mood-btn.active { background: rgba(26,107,42,.12); }
.mood-label { font-size: .72rem; color: var(--text-muted); display: block; margin-top: 2px; }
.streak-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: rgba(200,146,26,.08);
  border: 1px solid rgba(200,146,26,.25);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.streak-banner .streak-count { font-weight: 700; font-size: 1rem; }
.streak-banner small { color: var(--text-muted); font-size: .82rem; }

/* ── App Version Footer ───────────────────────────────────────── */
.app-footer {
  margin-left: var(--sidebar-w);
  padding: 12px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.app-footer-version {
  font-size: .75rem;
  color: var(--text-muted);
  opacity: .65;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}
@media (max-width: 768px) {
  .app-footer { margin-left: 0; padding: 12px 16px; }
}
