/* ===== Tiệm Chay Xanh – giao diện đặt món ===== */
:root {
  --green-900: #0f4a22;
  --green-700: #16612e;
  --green-500: #3d8a22;
  --leaf: #5aa02c;
  --orange: #f26b1d;
  --orange-600: #e05a0f;
  --cream: #fdf6ee;
  --cream-2: #f6f1e6;
  --chip: #eef2e1;
  --card: #ffffff;
  --line: #ece5d8;
  --ink: #1f2a1f;
  --muted: #5f6b5f;
  --radius: 18px;
  --shadow: 0 6px 22px rgba(60, 50, 20, .08);
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Nunito', var(--font);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
.container { width: min(1240px, 100% - 32px); margin-inline: auto; }
.icon-btn { background: none; border: 0; color: var(--green-900); padding: 6px; border-radius: 10px; line-height: 0; }
.icon-btn:hover { background: var(--chip); }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: #fef9f5;              /* trùng nền logo */
  box-shadow: 0 1px 0 var(--line);
}
.header-inner { display: flex; align-items: center; gap: 40px; min-height: 104px; }
.menu-toggle { display: none; }
.logo img { width: 140px; height: auto; mix-blend-mode: multiply; }
.main-nav { display: flex; gap: 56px; padding-left: 40px; border-left: 1px solid var(--line); }
.main-nav a {
  position: relative; padding: 8px 0;
  font-weight: 700; font-size: 1.15rem; color: var(--green-900); text-decoration: none;
}
.main-nav a.active::after, .main-nav a:hover::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -6px;
  height: 4px; border-radius: 4px; background: var(--orange);
}
.cart-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 10px;
  background: var(--orange); color: #fff; border: 0; border-radius: 16px;
  padding: 12px 24px; font-weight: 700; font-size: 1.15rem;
  box-shadow: 0 6px 16px rgba(242, 107, 29, .3);
  transition: background .15s, transform .15s;
}
.cart-btn:hover { background: var(--orange-600); transform: translateY(-1px); }
.cart-btn-count::before { content: '('; }
.cart-btn-count::after { content: ')'; }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(90deg, #f7efe1 0%, #f7efe1 45%, #f3ead9 100%);
  overflow: hidden;
}
.hero-inner { display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; min-height: 236px; position: relative; }
.hero-text { padding: 28px 0 28px 60px; position: relative; z-index: 1; }
.hero h1 {
  font-family: var(--font-display); font-style: italic; font-weight: 900;
  color: var(--green-900); font-size: clamp(2rem, 3.4vw, 3.1rem); line-height: 1.12;
  margin: 0 0 14px; letter-spacing: -.5px; position: relative;
}
.spark {
  display: inline-block; width: 30px; height: 30px; margin-left: 6px; vertical-align: top;
  background:
    linear-gradient(var(--orange), var(--orange)) 4px 18px / 14px 4px no-repeat,
    linear-gradient(var(--orange), var(--orange)) 12px 4px / 4px 14px no-repeat;
  transform: rotate(-20deg);
}
.hero p { margin: 0; font-size: 1.2rem; color: var(--ink); position: relative; }
.hero p::after {
  content: ''; display: block; width: 240px; height: 4px; margin-top: 18px;
  background: linear-gradient(90deg, transparent, var(--leaf) 40%, transparent); border-radius: 4px;
}
.hero-img { width: 100%; height: 236px; object-fit: cover; object-position: center;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18%);
          mask-image: linear-gradient(90deg, transparent 0, #000 18%); }

/* ===== Thanh công cụ ===== */
.order-area { padding: 18px 0 40px; }
.toolbar {
  display: grid; grid-template-columns: minmax(0, 1.45fr) auto minmax(0, 1fr);
  gap: 24px; align-items: center; padding: 6px 0 22px; border-bottom: 1px solid var(--line);
}
.address-field, .search-field {
  display: flex; align-items: center; gap: 10px; background: #fff;
  border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 8px 6px 18px; min-height: 52px;
}
.address-field:focus-within, .search-field:focus-within { border-color: var(--green-500); }
.address-field.disabled { opacity: .55; }
.address-label { font-weight: 700; white-space: nowrap; }
.address-field input, .search-field input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 1.02rem; color: var(--ink);
}
.address-field input {
  border: 1.5px solid var(--line); border-radius: 999px; padding: 9px 16px;
}
.search-field { padding-left: 18px; color: var(--green-900); }
.mode-toggle {
  display: inline-flex; background: var(--chip); border-radius: 999px; padding: 4px;
}
.mode-toggle button {
  display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent;
  color: var(--green-900); font-weight: 600; font-size: 1.02rem; padding: 10px 24px; border-radius: 999px;
}
.mode-toggle button.active { background: var(--green-700); color: #fff; box-shadow: 0 4px 10px rgba(22, 97, 46, .3); }

/* ===== Bố cục chính ===== */
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; padding-top: 22px; align-items: start; }

.chips { display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 18px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 0; background: var(--chip); color: var(--green-900);
  font-weight: 600; font-size: 1.02rem; padding: 10px 24px; border-radius: 999px; transition: background .15s;
}
.chip:hover { background: #e2ead0; }
.chip.active { background: var(--green-700); color: #fff; }

.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dish {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px; box-shadow: var(--shadow);
}
.dish img { width: 100%; height: 100%; min-height: 180px; object-fit: cover; border-radius: 14px; }
.dish-info { display: flex; flex-direction: column; padding: 10px 10px 10px 0; }
.dish h3 { margin: 4px 0 6px; font-size: 1.35rem; color: var(--green-900); }
.dish-desc { margin: 0; font-size: .92rem; color: var(--muted); line-height: 1.45; }
.dish-price { margin: 12px 0 14px; font-size: 1.45rem; font-weight: 700; color: var(--orange); }
.btn-add {
  margin-top: auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--orange); color: #fff; border: 0; border-radius: 12px; padding: 10px 14px;
  font-weight: 600; font-size: 1.02rem; transition: background .15s, transform .1s;
}
.btn-add:hover { background: var(--orange-600); }
.btn-add:active { transform: scale(.97); }
.menu-skeleton { height: 196px; border-radius: var(--radius); background: linear-gradient(90deg, #f1ebe0, #faf6ef, #f1ebe0); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.menu-error { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px 0; }
.link-btn { background: none; border: 0; color: var(--orange); font-weight: 700; text-decoration: underline; }

/* ===== Giỏ hàng ===== */
.cart-panel {
  position: sticky; top: 124px;
  background: linear-gradient(180deg, #f1f4e4 0, #f1f4e4 76px, #fff 76px);
  border: 1px solid var(--line); border-radius: 22px; padding: 18px 16px 20px;
  overflow: hidden;
}
.cart-panel::after {               /* lá trang trí góc dưới */
  content: ''; position: absolute; right: -40px; bottom: -40px; width: 180px; height: 110px;
  background: radial-gradient(ellipse at 60% 60%, #cfe3a9 0 45%, transparent 46%); pointer-events: none;
}
.cart-head { display: flex; align-items: center; justify-content: space-between; }
.cart-head h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; font-size: 1.4rem; color: var(--green-900); }
.cart-head h2 svg { color: var(--green-500); }
.cart-close { display: none; font-size: 1.2rem; }
.cart-body { position: relative; z-index: 1; }
.cart-list { list-style: none; margin: 0; padding: 0; }
.cart-item { display: grid; grid-template-columns: 66px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-item img { width: 66px; height: 56px; object-fit: cover; border-radius: 10px; }
.ci-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ci-info b { font-weight: 600; color: var(--green-900); }
.ci-info span { color: var(--orange); font-weight: 700; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button {
  width: 30px; height: 30px; border-radius: 10px; border: 0; background: var(--chip);
  color: var(--green-900); font-size: 1.2rem; font-weight: 700; line-height: 1;
}
.qty button:hover { background: #e2ead0; }
.qty span { min-width: 18px; text-align: center; font-weight: 700; }
.cart-empty { text-align: center; color: var(--muted); margin: 18px 0; line-height: 1.6; }
.cart-summary { padding: 16px 0; }
.row { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0; }
.row strong { font-size: 1.2rem; }
.row.muted em { color: var(--muted); font-size: .92rem; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: var(--orange); color: #fff; border: 0; border-radius: 14px; padding: 14px 18px;
  font-weight: 700; font-size: 1.12rem; box-shadow: 0 6px 16px rgba(242, 107, 29, .3);
  transition: background .15s, transform .1s;
}
.btn-primary:hover:not(:disabled) { background: var(--orange-600); }
.btn-primary:active:not(:disabled) { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* ===== Ưu đãi / Về tiệm ===== */
.info-section { padding: 24px 0; }
.section-title { font-size: 1.6rem; color: var(--green-900); margin: 0 0 14px; }
.promo-card { background: #fff; border: 1px dashed var(--orange); border-radius: var(--radius); padding: 20px 22px; }
.promo-card strong { color: var(--orange); font-size: 1.1rem; }
.promo-card p, .about-text { margin: 6px 0 0; color: var(--muted); line-height: 1.6; max-width: 760px; }

/* ===== Footer ===== */
.site-footer { background: #fff; border-top: 1px solid var(--line); margin-top: 24px; position: relative; overflow: hidden; }
.site-footer::after {
  content: ''; position: absolute; right: 0; bottom: 0; width: 340px; height: 70px;
  background: radial-gradient(ellipse at 100% 100%, #cfe3a9 0 55%, transparent 56%); pointer-events: none;
}
.footer-inner { display: flex; align-items: center; gap: 40px; min-height: 84px; flex-wrap: wrap; position: relative; z-index: 1; }
.footer-brand { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.2rem; color: var(--green-900); }
.footer-brand i { color: var(--green-900); }
.footer-sep { width: 1px; height: 32px; background: var(--line); }
.footer-web { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.1rem; color: var(--ink); }
.footer-web a { color: var(--green-700); font-weight: 700; }

/* ===== Hộp thoại đặt hàng ===== */
.checkout-dialog {
  width: min(520px, 100% - 24px); max-height: calc(100dvh - 24px);
  border: 0; border-radius: 22px; padding: 0; background: #fff; color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .25);
}
.checkout-dialog::backdrop { background: rgba(20, 30, 20, .45); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-size: 1.3rem; color: var(--green-900); }
.dlg-body { padding: 18px 22px; display: grid; gap: 14px; }
.dlg-foot { padding: 0 22px 22px; }
.mode-toggle.small { justify-self: start; }
.mode-toggle.small button { padding: 8px 20px; }
.field { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
.field[hidden] { display: none; }
.req { color: var(--orange); }
.field input, .field textarea {
  font: inherit; font-weight: 400; font-size: 1rem; padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; outline: 0; resize: vertical; color: var(--ink);
}
.field input:focus, .field textarea:focus { border-color: var(--green-500); }
.dlg-summary { background: var(--cream-2); border-radius: 14px; padding: 12px 16px; }
.dlg-summary ul { list-style: none; margin: 0 0 8px; padding: 0 0 8px; border-bottom: 1px dashed var(--line); }
.dlg-summary li { display: flex; justify-content: space-between; padding: 3px 0; }
.form-error { margin: 0; color: #c0261a; background: #fdecea; padding: 10px 14px; border-radius: 10px; }
.order-success { text-align: center; padding: 32px 26px 26px; }
.success-icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--green-700); color: #fff; font-size: 2rem; display: grid; place-items: center; }
.order-success h2 { margin: 0 0 12px; color: var(--green-900); }
.order-success p { margin: 4px 0; }
.order-code { font-size: 1.6rem; font-weight: 700; color: var(--orange); letter-spacing: 1px; }
.order-success .muted { color: var(--muted); margin: 12px 0 20px; line-height: 1.5; }

/* ===== Thông báo ===== */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--green-900); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600;
  transition: opacity .2s, transform .2s; pointer-events: none; z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.mobile-cart-bar, .backdrop { display: none; }

/* ===== Máy tính bảng ===== */
@media (max-width: 1100px) {
  .toolbar { grid-template-columns: 1fr auto; }
  .search-field { grid-column: 1 / -1; }
  .dish { grid-template-columns: 1fr; }
  .dish img { min-height: 0; aspect-ratio: 16 / 10; }
  .dish-info { padding: 4px 10px 10px; }
  .hero-text { padding-left: 40px; }
}

/* ===== Điện thoại ===== */
@media (max-width: 900px) {
  html { scroll-padding-top: 80px; }
  .header-inner { min-height: 92px; gap: 12px; justify-content: space-between; position: relative; }
  .menu-toggle { display: block; }
  .logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
  .logo img { width: 90px; }
  .main-nav {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0;
    background: #fff; border: 0; padding: 0 16px; box-shadow: 0 10px 20px rgba(0,0,0,.08);
    max-height: 0; overflow: hidden; transition: max-height .25s, padding .25s;
  }
  .main-nav.open { max-height: 240px; padding: 8px 16px 14px; }
  .main-nav a { padding: 14px 4px; border-bottom: 1px solid var(--line); }
  .main-nav a::after { display: none; }
  .cart-btn { padding: 10px 16px; border-radius: 14px; }
  .cart-btn-label { display: none; }
  .cart-btn-count { font-size: 1.15rem; }
  .cart-btn-count::before, .cart-btn-count::after { content: none; }

  .hero-inner { grid-template-columns: 1fr; min-height: 0; }
  .hero-inner::before { display: none; }
  .hero-text { padding: 22px 0 0; max-width: 78%; z-index: 2; }
  .hero h1 { font-size: clamp(1.45rem, 6.6vw, 2.2rem); text-shadow: 0 0 12px #f7efe1, 0 0 4px #f7efe1; }
  .hero p { font-size: .98rem; max-width: 62%; text-shadow: 0 0 8px #f7efe1, 0 0 3px #f7efe1; }
  .hero p::after { display: none; }
  .hero-img {
    position: absolute; right: -16px; bottom: 0; width: 64%; height: 100%;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 35%);
            mask-image: linear-gradient(90deg, transparent 0, #000 35%);
  }
  .hero { position: relative; }
  .hero-inner { padding-bottom: 46px; }

  .order-area { padding-top: 0; }
  .order-area > .container {
    /* Không đặt z-index ở đây: sẽ nhốt ngăn kéo giỏ hàng bên dưới lớp nền tối */
    background: #fff; border-radius: 26px 26px 0 0; margin-top: -26px; position: relative;
    padding: 18px 16px 0; width: 100%;
  }
  .toolbar { grid-template-columns: minmax(0, 1fr); gap: 14px; border: 0; padding-bottom: 0; }
  .address-field { padding-left: 14px; }
  .address-field input { padding: 8px 12px; }
  .mode-toggle:not(.small) { display: grid; grid-template-columns: 1fr 1fr; }
  .mode-toggle:not(.small) button { justify-content: center; }
  .search-field { grid-column: auto; }

  .order-layout { grid-template-columns: minmax(0, 1fr); padding-top: 16px; }
  .chips { margin-right: -16px; padding-right: 16px; }
  .menu-grid { gap: 14px; padding-bottom: 110px; }
  .dish { padding: 0; overflow: hidden; gap: 0; }
  .dish img { border-radius: 0; aspect-ratio: 16 / 9.5; }
  .dish-info { padding: 10px 12px 12px; }
  .dish h3 { font-size: 1.1rem; margin: 0 0 4px; }
  .dish-desc { display: none; }
  .dish-price { font-size: 1.15rem; margin: 0 0 10px; }
  .btn-add { border-radius: 999px; padding: 8px 10px; font-size: .95rem; }

  /* Giỏ hàng thành ngăn kéo từ dưới lên */
  .cart-panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 50;
    max-height: 85dvh; overflow-y: auto; border-radius: 24px 24px 0 0; border: 0;
    transform: translateY(105%); transition: transform .28s ease; padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .cart-panel.open { transform: none; }
  .cart-close { display: block; margin-top: -18px; }
  .backdrop { display: block; position: fixed; inset: 0; background: rgba(20, 30, 20, .45); z-index: 45; }
  .backdrop[hidden] { display: none; }

  .mobile-cart-bar {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 40;
    align-items: center; justify-content: space-between; gap: 8px;
    background: var(--green-700); color: #fff; border-radius: 22px; padding: 8px 8px 8px 18px;
    box-shadow: 0 10px 28px rgba(15, 74, 34, .35);
  }
  .mobile-cart-bar[hidden], body.no-scroll .mobile-cart-bar { display: none; }
  .mcb-info { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.05rem; }
  .mcb-btn {
    display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--orange); color: #fff;
    font-weight: 700; font-size: 1.05rem; padding: 12px 20px; border-radius: 999px; white-space: nowrap;
  }
  .toast { bottom: 96px; }

  .info-section .container, .site-footer .container { width: min(1240px, 100% - 32px); }
  .footer-inner { gap: 10px 20px; padding: 16px 0 100px; }
  .footer-sep { display: none; }
}

.mcb-info span { white-space: nowrap; }
@media (max-width: 420px) {
  .mcb-info { font-size: .95rem; gap: 8px; }
  .mcb-btn { padding: 11px 14px; font-size: .95rem; }
  .mobile-cart-bar { padding-left: 14px; }
  .menu-grid { gap: 10px; }
}

/* Hotline */
.hotline-link { color: var(--orange); font-weight: 700; font-size: 1.15rem; text-decoration: none; white-space: nowrap; }
.hotline-link:hover { text-decoration: underline; }
