/* ============================================================
   MM SUPERMARKET — DESIGN SYSTEM
   Every page links this one file. Changing it changes the whole site.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700;800&family=Work+Sans:wght@400;500;600;700&display=swap');

:root {
  --mm-bg: #F4F7F5;
  --mm-surface: #FFFFFF;
  --mm-ink: #1C2321;
  --mm-ink-soft: #5B6663;
  --mm-marigold: #E8A33D;
  --mm-marigold-dark: #C7811F;
  --mm-teal: #0F5257;
  --mm-teal-dark: #0B3F43;
  --mm-teal-light: #E4F0EF;
  --mm-green: #4C9A5A;
  --mm-red: #D64545;
  --mm-border: #E1E7E4;
  --mm-radius: 12px;
  --mm-radius-sm: 8px;
  --mm-shadow: 0 1px 3px rgba(28,35,33,.07);
  --mm-shadow-lg: 0 8px 24px rgba(28,35,33,.10);

  /* legacy aliases so older markup keeps working */
  --mm-card: var(--mm-surface);
  --mm-primary: var(--mm-teal);
  --mm-primary-dark: var(--mm-teal-dark);
  --mm-accent: var(--mm-marigold);
  --mm-danger: var(--mm-red);
}

* { box-sizing: border-box; }
html { overflow-x: hidden; -webkit-text-size-adjust: 100%; }
body {
  background: var(--mm-bg);
  color: var(--mm-ink);
  font-family: 'Work Sans', -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}
h1,h2,h3,h4,h5,h6,.navbar-brand,.brand { font-family: 'Baloo 2', sans-serif; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 28px; } h2 { font-size: 22px; } h3 { font-size: 20px; }
h4 { font-size: 18px; } h5 { font-size: 16px; } h6 { font-size: 14px; }
a { color: var(--mm-teal); text-decoration: none; }
a:hover { color: var(--mm-teal-dark); }

/* ---------- Navbar ---------- */
.navbar {
  background: var(--mm-teal) !important;
  box-shadow: var(--mm-shadow);
  padding: 10px 0;
}
.navbar-brand { font-size: 20px; font-weight: 700; color: #fff !important; }
.navbar .btn-outline-light {
  border-color: rgba(255,255,255,.35); font-size: 13px; font-weight: 600;
  padding: 5px 12px; border-radius: 18px;
}
.navbar .btn-outline-light:hover { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.6); }

/* ---------- Buttons ---------- */
.btn { font-weight: 600; border-radius: var(--mm-radius-sm); padding: 9px 18px; font-size: 14px; transition: all .15s ease; }
.btn-sm { padding: 6px 13px; font-size: 12.5px; border-radius: 6px; }
.btn-lg { padding: 12px 26px; font-size: 15.5px; }
.btn-primary { background: var(--mm-teal); border-color: var(--mm-teal); }
.btn-primary:hover, .btn-primary:focus { background: var(--mm-teal-dark); border-color: var(--mm-teal-dark); }
.btn-success { background: var(--mm-green); border-color: var(--mm-green); }
.btn-success:hover { background: #3F8249; border-color: #3F8249; }
.btn-warning { background: var(--mm-marigold); border-color: var(--mm-marigold); color: var(--mm-ink); }
.btn-danger { background: var(--mm-red); border-color: var(--mm-red); }
.btn-outline-primary { color: var(--mm-teal); border-color: var(--mm-teal); }
.btn-outline-primary:hover { background: var(--mm-teal); border-color: var(--mm-teal); }
.btn-outline-success { color: var(--mm-green); border-color: var(--mm-green); }
.btn-outline-success:hover { background: var(--mm-green); border-color: var(--mm-green); }
.btn:disabled { opacity: .45; }

/* ---------- Cards ---------- */
.card {
  background: var(--mm-surface);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius);
  box-shadow: var(--mm-shadow);
}
.product-card { transition: transform .15s ease, box-shadow .15s ease; }
.product-card:hover { transform: translateY(-3px); box-shadow: var(--mm-shadow-lg); }
.card-img-top { border-radius: var(--mm-radius) var(--mm-radius) 0 0; background: #F0F3F1; }

/* ---------- Forms ---------- */
.form-control, .form-select {
  border: 1.5px solid var(--mm-border);
  border-radius: var(--mm-radius-sm);
  padding: 10px 13px;
  font-size: 14px;
  background: var(--mm-surface);
}
.form-control:focus, .form-select:focus {
  border-color: var(--mm-teal);
  box-shadow: 0 0 0 3px rgba(15,82,87,.12);
}
.form-control::placeholder { color: #9AA5A2; }
.form-label { font-size: 13px; font-weight: 600; color: var(--mm-ink); margin-bottom: 5px; }
.form-check-input:checked { background-color: var(--mm-teal); border-color: var(--mm-teal); }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; font-size: 14px; }
.table > :not(caption) > * > * { padding: 11px 12px; }
.table thead th { background: var(--mm-teal-light); color: var(--mm-teal); font-weight: 600; font-size: 12.5px;
  text-transform: uppercase; letter-spacing: .03em; border: none; }
.table-bordered > :not(caption) > * > * { border-color: var(--mm-border); }
.table tbody tr:hover { background: #FAFCFB; }

/* ---------- Badges ---------- */
.badge { font-weight: 600; font-size: 11px; padding: 4px 8px; border-radius: 5px; }
.badge.bg-danger  { background: var(--mm-red) !important; }
.badge.bg-success { background: var(--mm-green) !important; }
.badge.bg-warning { background: var(--mm-marigold) !important; color: var(--mm-ink) !important; }
.badge.bg-info    { background: var(--mm-teal-light) !important; color: var(--mm-teal) !important; }
.badge.bg-secondary { background: #8A9694 !important; }

/* ---------- Alerts ---------- */
.alert { border: none; border-radius: var(--mm-radius-sm); font-size: 13.5px; padding: 12px 15px; }
.alert-warning { background: #FFF6E5; color: #7A5210; border-left: 3px solid var(--mm-marigold); }
.alert-success { background: #EAF6EC; color: #2C6135; border-left: 3px solid var(--mm-green); }
.alert-danger  { background: #FDECEC; color: #8C2A2A; border-left: 3px solid var(--mm-red); }
.alert-info    { background: var(--mm-teal-light); color: var(--mm-teal); border-left: 3px solid var(--mm-teal); }

/* ---------- List groups ---------- */
.list-group-item {
  border: none; border-bottom: 1px solid var(--mm-border);
  padding: 13px 15px; font-size: 14.5px; background: var(--mm-surface);
}
.list-group-item:first-child { border-radius: var(--mm-radius) var(--mm-radius) 0 0; }
.list-group-item:last-child  { border-radius: 0 0 var(--mm-radius) var(--mm-radius); border-bottom: none; }
.list-group-item:hover { background: var(--mm-teal-light); cursor: pointer; }

/* ---------- Product card internals ---------- */
.pcard { background: var(--mm-surface); border: 1px solid var(--mm-border); border-radius: var(--mm-radius);
  padding: 10px; position: relative; transition: transform .15s ease, box-shadow .15s ease; }
.pcard:hover { transform: translateY(-2px); box-shadow: var(--mm-shadow-lg); }
.pcard .img-box { height: 110px; background: #F0F3F1; border-radius: var(--mm-radius-sm);
  margin-bottom: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pcard .name { font-size: 12.5px; font-weight: 500; line-height: 1.3; height: 32px; overflow: hidden; color: var(--mm-ink); }
.pcard .rating { font-size: 11px; color: var(--mm-marigold-dark); }
.pcard .price-row { display: flex; gap: 5px; align-items: baseline; margin-top: 6px; flex-wrap: wrap; }
.pcard .price { font-weight: 700; font-size: 15px; }
.pcard .mrp { font-size: 11px; color: var(--mm-ink-soft); text-decoration: line-through; }
.pcard .add-btn { margin-top: 8px; width: 100%; border: 1.5px solid var(--mm-teal); color: var(--mm-teal);
  background: var(--mm-surface); border-radius: 7px; padding: 6px 0; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pcard .add-btn:hover { background: var(--mm-teal); color: #fff; }
.wishlist-heart { position: absolute; top: 8px; right: 8px; background: #fff; border-radius: 50%;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--mm-shadow); cursor: pointer; border: none; font-size: 15px; color: #CBD3D1; z-index: 2; }
.wishlist-heart.active { color: var(--mm-red); }
.stock-note { font-size: 10.5px; color: var(--mm-red); font-weight: 600; }
.off-pct { font-size: 10.5px; color: var(--mm-green); font-weight: 700; }
.compare-check { font-size: 10.5px; color: var(--mm-ink-soft); display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.letter-avatar { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700; color: #fff; font-family: 'Baloo 2', sans-serif; }
.price-strike { color: var(--mm-ink-soft); text-decoration: line-through; font-size: .9em; }
.price-current { color: var(--mm-teal); font-weight: 700; font-size: 1.1em; }

/* ---------- Pharmacy safety ---------- */
.pcard.is-rx { border-color: var(--mm-teal); background: #F7FBFB; }
.rx-warning { display: flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600;
  color: var(--mm-teal); background: var(--mm-teal-light); border-radius: 5px; padding: 4px 7px; margin-top: 6px; }
.add-btn.rx-btn { display: block; text-align: center; text-decoration: none;
  background: var(--mm-teal); color: #fff; border-color: var(--mm-teal); }
.add-btn.rx-btn:hover { background: var(--mm-teal-dark); color: #fff; }
.schedule-tag { position: absolute; top: -8px; left: 8px; z-index: 2; background: var(--mm-teal);
  color: #fff; font-size: 9.5px; font-weight: 700; padding: 3px 7px; border-radius: 5px; }
.deal-tag { position: absolute; top: -8px; left: 8px; z-index: 2; background: var(--mm-red);
  color: #fff; font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 5px; }

/* ---------- Delivery promise ---------- */
.delivery-promise { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; margin-top: 5px; }
.promise-express  { color: var(--mm-green); }
.promise-today    { color: var(--mm-teal); }
.promise-tomorrow { color: var(--mm-ink-soft); }
.pack-size { font-size: 11px; color: var(--mm-ink-soft); margin-top: 2px; }
.add-btn.notify-btn { display: flex; align-items: center; justify-content: center; gap: 5px;
  border-color: var(--mm-ink-soft); color: var(--mm-ink-soft); }

/* ---------- Ratings ---------- */
.rating-summary { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.rating-big { text-align: center; }
.rating-big .num { font-size: 34px; font-weight: 700; font-family: 'Baloo 2', sans-serif; line-height: 1; }
.rating-big .stars { color: var(--mm-marigold-dark); font-size: 15px; }
.rating-big .count { font-size: 11.5px; color: var(--mm-ink-soft); }
.hist-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; margin-bottom: 3px; }
.hist-bar { flex: 1; height: 7px; background: #EDF1EF; border-radius: 4px; overflow: hidden; }
.hist-fill { height: 100%; background: var(--mm-marigold); }

/* ---------- Frequently bought together ---------- */
.fbt-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fbt-item { text-align: center; width: 96px; font-size: 11.5px; }
.fbt-item .thumb { height: 72px; border-radius: var(--mm-radius-sm); overflow: hidden; background: #F0F3F1; margin-bottom: 4px; }
.fbt-plus { font-size: 20px; color: var(--mm-ink-soft); }
.fbt-total { margin-left: auto; text-align: right; }
.fbt-total .amt { font-size: 19px; font-weight: 700; font-family: 'Baloo 2', sans-serif; }

/* ---------- Trust / conversion ---------- */
.trust-mini { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; padding: 12px;
  background: var(--mm-teal-light); border-radius: var(--mm-radius-sm); font-size: 12px;
  color: var(--mm-teal); font-weight: 600; margin: 14px 0; }
.trust-mini span { display: flex; align-items: center; gap: 5px; }
.free-del-wrap { margin: 10px 0; }
.free-del-text { font-size: 12px; font-weight: 600; margin-bottom: 5px; }
.free-del-text.done { color: var(--mm-green); }
.free-del-bar { height: 6px; background: #E4E9E7; border-radius: 4px; overflow: hidden; }
.free-del-fill { height: 100%; background: var(--mm-marigold); transition: width .3s ease; }
.compliance-note { font-size: 11px; line-height: 1.55; color: var(--mm-ink-soft);
  border-top: 1px solid var(--mm-border); padding-top: 12px; margin-top: 18px; }
.urgency-line { font-size: 12px; font-weight: 600; color: var(--mm-red); background: #FDECEC;
  border-radius: 6px; padding: 7px 10px; margin: 8px 0; display: inline-block; }
.sticky-buy { position: fixed; bottom: 0; left: 0; right: 0; z-index: 70; background: #fff;
  border-top: 1px solid var(--mm-border); padding: 10px 14px; display: none;
  align-items: center; justify-content: space-between; gap: 12px; box-shadow: 0 -2px 12px rgba(0,0,0,.08); }
.sticky-buy.show { display: flex; }
.sticky-buy .sb-price { font-weight: 700; font-size: 16px; }
.sticky-buy .sb-sub { font-size: 11px; color: var(--mm-ink-soft); }
.sticky-buy .sb-btn { background: var(--mm-green); color: #fff; border: none; border-radius: 22px;
  padding: 10px 24px; font-weight: 700; font-size: 14px; cursor: pointer; }
@media (min-width: 860px) { .sticky-buy { display: none !important; } }

/* ---------- Skeleton loading (replaces bare "Loading..." text) ---------- */
.mm-skeleton { background: linear-gradient(90deg,#EDF1EF 25%,#F6F8F7 50%,#EDF1EF 75%);
  background-size: 200% 100%; animation: mmShimmer 1.4s infinite; border-radius: var(--mm-radius-sm); }
@keyframes mmShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skel-card { height: 210px; }
.skel-row { display: flex; gap: 12px; overflow: hidden; }
.skel-row .mm-skeleton { flex: 0 0 140px; }

/* ---------- Empty states ---------- */
.mm-empty { text-align: center; padding: 34px 18px; color: var(--mm-ink-soft); }
.mm-empty .ico { width: 46px; height: 46px; margin: 0 auto 10px; color: #C3CDCA; }
.mm-empty h5 { color: var(--mm-ink); margin-bottom: 5px; }
.mm-empty p { font-size: 13.5px; margin-bottom: 14px; }

/* ---------- Page headers ---------- */
.page-head { margin-bottom: 18px; }
.page-head h3 { margin-bottom: 3px; }
.page-head p { font-size: 13.5px; color: var(--mm-ink-soft); margin: 0; }

/* ---------- Dark mode ---------- */
html[data-theme="dark"] {
  --mm-bg: #121417; --mm-surface: #1E2126; --mm-ink: #E5E7EB;
  --mm-ink-soft: #9CA3AF; --mm-border: #2E3338; --mm-teal-light: #14312F;
}
html[data-theme="dark"] body { background: var(--mm-bg); color: var(--mm-ink); }
html[data-theme="dark"] .card, html[data-theme="dark"] .pcard,
html[data-theme="dark"] .list-group-item { background: var(--mm-surface); color: var(--mm-ink); }
html[data-theme="dark"] .form-control, html[data-theme="dark"] .form-select {
  background: var(--mm-surface); color: var(--mm-ink); border-color: var(--mm-border); }
html[data-theme="dark"] .table { color: var(--mm-ink); }
html[data-theme="dark"] .bg-white { background: var(--mm-surface) !important; }
html[data-theme="dark"] .text-muted { color: var(--mm-ink-soft) !important; }
html[data-theme="dark"] .pcard .img-box { background: #23272C; }

.theme-toggle-btn { position: fixed; bottom: 20px; right: 20px; z-index: 1050;
  width: 46px; height: 46px; border-radius: 50%; border: none; background: var(--mm-teal);
  color: #fff; font-size: 19px; box-shadow: var(--mm-shadow-lg); cursor: pointer; }

/* ---------- Mobile ---------- */
@media (max-width: 575px) {
  h1 { font-size: 23px; } h2 { font-size: 19px; } h3 { font-size: 18px; }
  .container { padding-left: 14px; padding-right: 14px; }
  .btn { padding: 9px 15px; }
  .table { font-size: 13px; }
  .navbar { padding: 8px 0; }
}
