/* Theme variables are injected from /api/config at runtime; these are fallbacks. */
:root {
  --bg: #FFF6E3;
  --surface: #FFFFFF;
  --surface2: #FFEFC7;
  --text: #3A1010;
  --muted: #8A6A50;
  --primary: #8E1414;
  --primary-soft: #A82A1F;
  --primary-text: #FFFFFF;
  --accent: #F5B301;
  --accent-text: #3A1010;
  --border: #EAD9B0;
  --header-bg: #8E1414;
  --header-text: #FFD95E;
  --hero-bg: #FFC72C;
  --hero-text: #5A1010;
  --footer-bg: #221111;
  --footer-text: #F3E3C8;
  --footer-muted: #C9A67E;
  --shadow: 0 10px 30px rgba(0, 0, 0, .12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
button { font: inherit; cursor: pointer; }

.brand-name, .footer-brand-name, .hero h1, .login-card h1, .admin-topbar h1 {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  letter-spacing: .2px;
}

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 26px; height: 26px; }
input, textarea, select { font: inherit; color: inherit; }

/* ---------------- header ---------------- */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .25);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-emoji { font-size: 2rem; }
.brand-logo { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
.brand-name {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: .3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-tagline { font-size: .72rem; opacity: .85; }
.cart-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .25);
  transition: transform .15s;
}
.cart-btn:active { transform: scale(.96); }
.cart-count {
  background: var(--primary);
  color: var(--primary-text);
  border-radius: 999px;
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  padding: 0 6px;
}

/* ---------------- hero ---------------- */
.hero {
  background: var(--hero-bg);
  color: var(--hero-text);
  text-align: center;
  padding: 34px 16px 38px;
}
.hero h1 { font-size: clamp(1.5rem, 4.5vw, 2.4rem); font-weight: 900; letter-spacing: .5px; }
.hero p { margin-top: 8px; font-size: clamp(.9rem, 2.6vw, 1.05rem); opacity: .9; }

/* ---------------- toolbar / catalog ---------------- */
.container { max-width: 1100px; margin: 0 auto; padding: 18px 16px 90px; width: 100%; flex: 1; }
.toolbar { position: sticky; top: 62px; z-index: 30; background: var(--bg); padding: 10px 0; }
.search-wrap { position: relative; }
.search-wrap .icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  outline: none;
}
.search:focus { border-color: var(--accent); }
.chips-scroll { overflow-x: auto; margin-top: 10px; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chips { display: flex; gap: 8px; width: max-content; padding-bottom: 2px; }
.chip {
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .88rem;
  white-space: nowrap;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }

.cat-section { margin-top: 26px; }
.cat-title {
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.cat-title::after { content: ""; flex: 1; height: 2px; background: var(--border); border-radius: 2px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-3px); }
.card-img {
  aspect-ratio: 4 / 3;
  width: 100%;
  object-fit: cover;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-name { font-weight: 700; font-size: 1rem; line-height: 1.25; }
.card-desc { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.card-row { margin-top: auto; display: flex; align-items: center; gap: 8px; }
.variant-select {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  font-size: .85rem;
  font-weight: 600;
}
.card-price { font-weight: 800; font-size: 1.05rem; color: var(--primary); white-space: nowrap; }
.add-btn {
  width: 100%;
  border: none;
  background: var(--primary);
  color: var(--primary-text);
  padding: 10px;
  border-radius: 12px;
  font-weight: 700;
  transition: background .15s, transform .1s;
}
.add-btn:hover { background: var(--primary-soft); }
.add-btn:active { transform: scale(.97); }
.add-btn.added { background: #1a8f3c; }
.empty-note { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------------- floating cart bar ---------------- */
.cart-fab {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  z-index: 45;
  border: none;
  background: var(--primary);
  color: var(--primary-text);
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  width: max-content;
  max-width: calc(100vw - 32px);
}

/* ---------------- drawer / modals ---------------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 8, 4, .55);
  z-index: 50;
  backdrop-filter: blur(2px);
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(420px, 100vw);
  background: var(--surface);
  z-index: 60;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 30px rgba(0, 0, 0, .3);
  animation: slideIn .25s ease;
}
@keyframes slideIn { from { transform: translateX(60px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-body { flex: 1; overflow-y: auto; padding: 12px 16px; }
.drawer-foot { border-top: 1px solid var(--border); padding: 14px 16px; background: var(--surface2); }
.cart-total-row { display: flex; justify-content: space-between; font-size: 1.1rem; margin-bottom: 10px; }
.cart-empty { text-align: center; color: var(--muted); padding: 50px 10px; }

.cart-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-weight: 700; font-size: .92rem; }
.cart-item-variant { font-size: .78rem; color: var(--muted); }
.cart-item-price { font-weight: 700; color: var(--primary); font-size: .9rem; margin-top: 2px; }
.qty-ctrl { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  font-weight: 800;
  line-height: 1;
}
.remove-btn { border: none; background: none; color: #b3261e; font-size: 1rem; padding: 4px; }

.icon-btn {
  border: none;
  background: var(--surface2);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 1rem;
}
.btn {
  border: none;
  border-radius: 13px;
  padding: 13px 20px;
  font-weight: 700;
  transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-block { width: 100%; display: block; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(20, 8, 4, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  backdrop-filter: blur(2px);
  overflow-y: auto;
}
.modal-card {
  background: var(--surface);
  border-radius: 20px;
  width: min(520px, 100%);
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
  animation: pop .2s ease;
}
@keyframes pop { from { transform: scale(.95); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.pay-note {
  background: var(--surface2);
  border: 1.5px dashed var(--accent);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: .86rem;
  line-height: 1.45;
  margin: 10px 0 14px;
}
form label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 10px; }
form input, form textarea, form select {
  width: 100%;
  margin-top: 4px;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  outline: none;
}
form input:focus, form textarea:focus { border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checkout-summary {
  background: var(--surface2);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: .88rem;
  margin: 6px 0 12px;
}
.checkout-summary .sum-row { display: flex; justify-content: space-between; padding: 2px 0; }
.checkout-summary .sum-total { border-top: 1.5px solid var(--border); margin-top: 6px; padding-top: 6px; font-weight: 800; }
.form-error { color: #b3261e; font-size: .85rem; margin-bottom: 10px; font-weight: 600; }
.success-card { text-align: center; }
.success-emoji { font-size: 3rem; }
.success-card h2 { margin: 8px 0; }
.success-card p { margin-bottom: 10px; font-size: .95rem; }

/* ---------------- footer ---------------- */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  margin-top: 40px;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px 20px;
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1.2fr;
  gap: 28px;
}
.footer-col h3 {
  font-size: .95rem;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--footer-text);
}
.footer-brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.footer-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.footer-brand-name { font-weight: 800; font-size: 1.05rem; }
.footer-about { font-size: .84rem; line-height: 1.6; color: var(--footer-muted); margin-bottom: 14px; }
.footer-social { display: flex; gap: 10px; }
.footer-social a {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  text-decoration: none;
  transition: background .15s;
}
.footer-social a:hover { background: var(--accent); }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.footer-links a {
  color: var(--footer-muted);
  text-decoration: none;
  font-size: .86rem;
  transition: color .15s;
}
.footer-links a:hover { color: var(--footer-text); }
.footer-contact { list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: .86rem; color: var(--footer-muted); }
.footer-contact li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.4; }
.footer-contact a { color: inherit; text-decoration: none; }
.footer-contact a:hover { color: var(--footer-text); }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding: 16px 20px 22px;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  font-size: .78rem;
  color: var(--footer-muted);
}
.footer-payment-note {
  background: rgba(255, 255, 255, .08);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .76rem;
}
@media (max-width: 860px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 500px) {
  .footer-inner { grid-template-columns: 1fr; gap: 22px; }
  .footer-bottom { flex-direction: column; text-align: center; }
}

/* ---------------- policies page ---------------- */
.policy-wrap { max-width: 820px; margin: 0 auto; padding: 30px 18px 60px; }
.policy-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; position: sticky; top: 62px; background: var(--bg); padding: 10px 0; z-index: 10; }
.policy-section { margin-bottom: 34px; scroll-margin-top: 120px; }
.policy-section h2 { font-size: 1.3rem; margin-bottom: 12px; color: var(--primary); }
.policy-section h3 { font-size: 1rem; margin: 16px 0 6px; }
.policy-section p, .policy-section li { font-size: .92rem; line-height: 1.7; color: var(--text); }
.policy-section ul, .policy-section ol { margin-left: 22px; margin-bottom: 10px; }
.policy-updated { color: var(--muted); font-size: .8rem; margin-bottom: 24px; }

/* ---------------- mobile ---------------- */
@media (max-width: 640px) {
  .brand-tagline { display: none; }
  .brand-name { font-size: 1.1rem; }
  .cart-label { display: none; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-img { font-size: 2.3rem; }
  .card-body { padding: 10px; }
  .card-name { font-size: .88rem; }
  .card-desc { display: none; }
  .toolbar { top: 58px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .hero { padding: 24px 14px 28px; }
}
