/* =====================================================
   GIAO DIỆN CÁC TÍNH NĂNG CÓ MÁY CHỦ: tài khoản, đánh giá,
   mã giảm giá, mã QR, vòng quay, trang quản trị
   (dùng token màu trong style.css / pages.css)
   ===================================================== */

.auth, .acct-page, .reviews, .admin, .admin-gate {
  padding-left: max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter)));
  padding-right: max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter)));
}
.empty-note { font-size: 14px; line-height: 1.7; color: var(--muted); }
.empty-note a, .reviews__hint a, .my-coupons__hint a, .spin-card__text a { font-weight: 700; color: var(--red); }
.star { color: var(--red); }
.stars { font-family: var(--font-symbol); letter-spacing: 1px; color: var(--red); }
.stars__off { color: var(--line); }

/* ===== Nút tài khoản trên header ===== */
.account-slot { display: flex; align-items: center; }
.account-link { font-weight: 700; font-size: 14px; color: var(--ink); white-space: nowrap; }
.account-link:hover { color: var(--red); }
.account-menu { position: relative; }
.account-menu__btn { display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; font-weight: 700; font-size: 14px; }
.account-menu__btn::-webkit-details-marker { display: none; }
.account-menu__avatar {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--blush); color: var(--red); font-weight: 800;
}
.account-menu__list {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 20;
  display: flex; flex-direction: column; min-width: 200px; padding: 8px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--white);
  box-shadow: 0 16px 40px rgba(48, 34, 29, .14);
}
.account-menu__list a, .account-menu__list button {
  padding: 10px 12px; border: 0; border-radius: 8px; background: none;
  text-align: left; font-size: 14px; color: var(--ink);
}
.account-menu__list a:hover, .account-menu__list button:hover { background: var(--cream); color: var(--red); }

/* ===== Điểm đánh giá trên thẻ món / danh mục ===== */
.product__rating { font-weight: 700; font-size: 13px; color: var(--ink); }
.product__rating-count { font-weight: 400; color: var(--muted); }
.category__rating { display: block; margin-top: 5px; font-weight: 700; font-size: 11px; color: var(--ink); }
.detail__rating a { color: var(--muted); text-decoration: underline; }

/* ===== Khu đánh giá ở trang chi tiết ===== */
.reviews { display: flex; flex-direction: column; gap: 20px; padding-top: 8px; padding-bottom: 56px; }
.reviews:empty { display: none; }
.reviews__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.reviews__avg { font-size: 14px; color: var(--muted); }
.reviews__avg strong { font-size: 18px; color: var(--ink); }
.reviews__hint { padding: 14px 16px; border-radius: 12px; background: var(--sand); font-size: 13px; color: var(--muted); }
.reviews__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.reviews__empty { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
.review { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.review__top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.review__date { margin-left: auto; font-size: 12px; color: var(--muted); }
.review__text { margin-top: 8px; font-size: 14px; line-height: 1.7; color: var(--muted); overflow-wrap: anywhere; }
.review-form {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  padding: 20px; border: 1.5px solid var(--red); border-radius: 16px; background: var(--blush);
}
.review-form__title { font-weight: 800; font-size: 16px; }
.review-form textarea { background: var(--white); }
/* chấm sao: input xếp ngược (5→1) để CSS tô các sao phía trước */
.star-input { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label { font-family: var(--font-symbol); font-size: 34px; line-height: 1; color: #e6cfc6; cursor: pointer; transition: color .1s ease; }
.star-input input:checked ~ label, .star-input label:hover, .star-input label:hover ~ label { color: var(--red); }
.star-input input:focus-visible + label { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }

/* ===== Mã của tôi (giỏ hàng) ===== */
.my-coupons { display: flex; flex-direction: column; gap: 8px; }
.my-coupons__title { font-weight: 700; font-size: 13px; }
.my-coupons__hint { font-size: 12px; line-height: 1.6; color: var(--muted); }
.coupon-chip {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center;
  padding: 10px 12px; border: 1.5px dashed #e7b9ad; border-radius: 10px; background: var(--white); text-align: left; color: var(--ink);
}
.coupon-chip:hover { border-color: var(--red); }
.coupon-chip.is-applied { border-style: solid; border-color: var(--red); background: var(--blush); }
.coupon-chip__code { font-weight: 800; font-size: 13px; color: var(--red); }
.coupon-chip__desc { grid-column: 1; font-size: 11px; color: var(--muted); }
.coupon-chip__use { grid-row: 1 / span 2; grid-column: 2; font-weight: 700; font-size: 12px; color: var(--red); }

/* ===== Đăng nhập / đăng ký ===== */
.auth { display: flex; align-items: center; gap: 80px; padding-top: 56px; padding-bottom: 88px; }
.auth__intro { display: flex; flex-direction: column; gap: 22px; flex: 1; min-width: 0; }
.auth__title { font-weight: 900; font-size: 48px; line-height: 1.15; letter-spacing: -2px; }
.auth__perks { display: flex; flex-direction: column; gap: 14px; font-size: 15px; color: var(--muted); }
.auth__perks li { display: flex; align-items: flex-start; gap: 10px; }
.auth__perks strong { color: var(--ink); }
.auth__card { flex: 0 1 460px; min-width: 0; gap: 20px; }
.auth__form { display: flex; flex-direction: column; gap: 16px; }
.auth__form[hidden] { display: none; }
.auth__alt { align-self: center; }
.auth__terms, .auth__hint { font-size: 12px; line-height: 1.7; color: var(--muted); }
.auth__hint { font-size: 14px; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 100px; background: var(--sand); }
.tabs[hidden] { display: none; }
.tab { flex: 1; height: 40px; border: 0; border-radius: 100px; background: none; font-weight: 700; font-size: 14px; color: var(--muted); }
.tab.is-active { background: var(--white); color: var(--red); box-shadow: 0 2px 6px rgba(48, 34, 29, .08); }

/* ===== Tài khoản của tôi ===== */
.acct-page { display: flex; align-items: flex-start; gap: 32px; padding-bottom: 72px; }
.account__main { display: flex; flex-direction: column; gap: 24px; flex: 1; min-width: 0; }
.account__side { display: flex; flex-direction: column; gap: 20px; flex: 0 1 400px; min-width: 0; }
.account__side .card { gap: 16px; }
.wallet, .my-orders { display: flex; flex-direction: column; gap: 12px; }
.wallet__welcome { padding: 14px 16px; border-radius: 12px; background: var(--mint); font-size: 14px; color: var(--green); }
.voucher { display: flex; align-items: center; gap: 16px; padding-right: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--cream); overflow: hidden; }
.voucher__left { display: flex; align-items: center; justify-content: center; align-self: stretch; min-width: 132px; padding: 16px 12px; background: var(--red); border-right: 2px dashed var(--cream); }
.voucher__code { font-weight: 800; font-size: 13px; letter-spacing: .5px; color: var(--white); text-align: center; overflow-wrap: anywhere; }
.voucher__body { flex: 1; min-width: 0; padding: 12px 0; }
.voucher__desc { font-weight: 700; font-size: 14px; }
.voucher__meta { margin-top: 4px; font-size: 12px; color: var(--muted); }
.my-order { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; transition: border-color .15s ease; }
.my-order:hover { border-color: var(--red); }
.my-order__img { width: 64px; height: 64px; flex-shrink: 0; object-fit: cover; border-radius: 10px; }
.my-order__body { flex: 1; min-width: 0; }
.my-order__top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.my-order__items { margin-top: 4px; font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-order__meta { margin-top: 4px; font-size: 12px; color: var(--muted); }
.my-order__total { font-weight: 800; font-size: 15px; color: var(--red); white-space: nowrap; }

.status-pill, .pay-pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 100px; font-weight: 700; font-size: 11px; white-space: nowrap; }
.status-pill--new { background: var(--red); color: var(--white); }
.status-pill--confirmed, .status-pill--cooking { background: var(--yellow); color: var(--ink); }
.status-pill--delivering { background: var(--blush); color: var(--red); }
.status-pill--done { background: var(--mint); color: var(--green); }
.status-pill--cancelled { background: var(--sand); color: var(--muted); }
.pay-pill--paid { background: var(--mint); color: var(--green); }
.pay-pill--wait { background: var(--blush); color: var(--red); }
.pay-pill--cod { background: var(--sand); color: var(--ink); }

/* ===== Mã QR thanh toán (trang theo dõi đơn) ===== */
.qr-card { display: flex; align-items: center; gap: 28px; padding: 28px; border: 1.5px solid var(--red); border-radius: 20px; background: var(--white); }
.qr-card__img { width: 240px; height: 240px; flex-shrink: 0; border-radius: 12px; background: var(--sand); object-fit: contain; }
.qr-card__info { display: flex; flex-direction: column; gap: 12px; flex: 1; min-width: 0; }
.qr-card__title { font-weight: 800; font-size: 22px; }
.qr-card__text { font-size: 13px; color: var(--muted); }
.qr-card .bank-box { padding: 14px; background: var(--cream); }
.qr-card__wait { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--red); }
.qr-card__dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--red); animation: pulse 1.2s ease-in-out infinite; }
.eta-card--cancelled { background: var(--sand); }
.eta-card--cancelled .eta-card__clock { font-size: 64px; letter-spacing: -3px; color: var(--muted); }

.review-cta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.review-cta__title { font-weight: 700; font-size: 13px; }
.review-cta__link { padding: 7px 12px; border: 1px solid var(--line); border-radius: 100px; font-weight: 600; font-size: 12px; color: var(--red); }
.review-cta__link:hover { border-color: var(--red); background: var(--blush); }

/* ===== Vòng quay may mắn ===== */
.spin-card { display: flex; align-items: center; gap: 16px; padding: 20px 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); }
.spin-card--ready { border: 1.5px solid var(--red); background: var(--blush); }
.spin-card__icon { font-size: 34px; line-height: 1; }
.spin-card > div { flex: 1; min-width: 0; }
.spin-card__title { font-weight: 800; font-size: 16px; }
.spin-card__text { margin-top: 4px; font-size: 13px; color: var(--muted); }
.spin-card--ready .spin-card__icon { animation: wheel-idle 3s linear infinite; }
@keyframes wheel-idle { to { transform: rotate(360deg); } }

.wheel-modal { width: min(440px, calc(100% - 32px)); }
.wheel-modal__box { position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 28px 24px 24px; text-align: center; }
.wheel-modal__close { position: absolute; right: 16px; top: 16px; }
.wheel { position: relative; width: min(300px, 76vw); aspect-ratio: 1; margin-top: 6px; }
.wheel__disc { width: 100%; height: 100%; border-radius: 50%; box-shadow: 0 10px 30px rgba(48, 34, 29, .25); will-change: transform; }
.wheel__svg { display: block; width: 100%; height: 100%; font-family: var(--font); }
.wheel__pointer {
  position: absolute; left: 50%; top: -10px; z-index: 2; transform: translateX(-50%);
  width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 26px solid var(--ink);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .25));
}
.wheel__disc { cursor: pointer; }
.wheel__hub {
  position: absolute; left: 50%; top: 50%; z-index: 2; transform: translate(-50%, -50%);
  width: 23%; aspect-ratio: 1; border-radius: 50%; border: 4px solid var(--ink);
  background: var(--yellow, #f7cf78); color: var(--ink); font-weight: 900; font-size: 15px; letter-spacing: .5px;
  box-shadow: 0 4px 10px rgba(48, 34, 29, .35); cursor: pointer; transition: transform .15s;
}
.wheel__hub:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.08); }
.wheel__hub:disabled { cursor: default; }
.wheel__lock {
  position: absolute; inset: 0; z-index: 3; display: none; place-items: center; border-radius: 50%;
  background: rgba(255, 248, 237, .55); font-size: 40px; pointer-events: none;
}
.wheel--locked .wheel__lock { display: grid; }
.wheel--locked .wheel__disc { cursor: default; filter: grayscale(.6); }
.wheel--locked .wheel__hub { color: transparent; }
.wheel--ready .wheel__disc { animation: wheel-ready .6s ease 2; }
@keyframes wheel-ready { 50% { transform: scale(1.05); } }
.wheel-modal__sound {
  position: absolute; left: 16px; top: 16px; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--white); font-size: 16px; cursor: pointer;
}
.wheel-modal__box { overflow: hidden; }
.wheel-modal__box--win .wheel-modal__code { animation: code-pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes code-pop { from { transform: scale(.4); opacity: 0; } }
.confetti { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.confetti span {
  position: absolute; top: -12px; width: 8px; height: 13px; border-radius: 2px; opacity: 0;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--drift), 640px) rotate(var(--spin)); }
}
.wheel-modal__result { min-height: 24px; }
.wheel-modal__win { font-size: 16px; }
.wheel-modal__code { display: inline-block; margin: 8px 0; padding: 8px 18px; border: 2px dashed var(--red); border-radius: 10px; background: var(--blush); font-weight: 800; font-size: 18px; letter-spacing: 1px; color: var(--red); }
.wheel-modal__note, .wheel-modal__lose { font-size: 13px; line-height: 1.6; color: var(--muted); }
.wheel-modal__lose strong { color: var(--ink); }

/* ===== TRANG QUẢN TRỊ ===== */
.admin-body { background: var(--cream); }
.admin-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px max(16px, calc((100% - var(--max)) / 2 + var(--gutter)));
  border-bottom: 1px solid var(--line); background: var(--cream);
}
.admin-bar .brand__name { font-size: 22px; letter-spacing: -0.5px; }
.admin-bar .brand__mark { height: 36px; }
.admin-bar__tag { padding: 4px 10px; border-radius: 100px; background: var(--ink); font-weight: 800; font-size: 11px; letter-spacing: 1px; color: var(--cream); }
.admin-bar__live { font-weight: 600; font-size: 12px; color: var(--muted); }
.admin-bar__live.is-on { color: var(--green); }
.admin-bar__actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.admin { display: flex; flex-direction: column; gap: 20px; padding-top: 24px; padding-bottom: 72px; }
.admin[hidden], .admin-gate[hidden] { display: none; }
.admin-gate { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; padding-top: 72px; padding-bottom: 72px; }
.admin-gate code { padding: 2px 6px; border-radius: 6px; background: var(--sand); font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.stat__num { font-weight: 900; font-size: 28px; letter-spacing: -1px; color: var(--red); }
.stat__label { font-size: 13px; color: var(--muted); }
.tabs--admin { align-self: flex-start; min-width: min(420px, 100%); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { height: 36px; padding: 0 16px; border: 1px solid var(--line); border-radius: 100px; background: var(--white); font-weight: 600; font-size: 13px; color: var(--ink); }
.chip.is-active { border-color: var(--red); background: var(--red); color: var(--white); }

.admin-orders { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; align-items: start; }
.admin-order { display: flex; flex-direction: column; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.admin-order--new { border: 2px solid var(--red); box-shadow: 0 8px 24px rgba(216, 60, 40, .12); animation: step-in .4s ease-out both; }
.admin-order__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-order__code { font-size: 16px; }
.admin-order__time { margin-left: auto; font-size: 12px; color: var(--muted); }
.admin-order__items { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px; background: var(--cream); font-size: 13px; line-height: 1.5; }
.admin-order__items span { color: var(--muted); }
.admin-order__items em { display: block; font-style: normal; font-weight: 600; color: var(--red); }
.admin-order__customer { display: flex; flex-direction: column; gap: 4px; font-size: 13px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.admin-order__customer strong { color: var(--ink); }
.admin-order__customer a { font-weight: 700; color: var(--red); }
.admin-order__note { color: var(--ink); }
.admin-order__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.admin-order__total { font-weight: 800; font-size: 18px; color: var(--red); }
.admin-order__total small { font-weight: 400; font-size: 11px; color: var(--muted); }
.admin-order__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.coupon-form { margin-bottom: 16px; gap: 16px; }
.coupon-form__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.admin-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.admin-table:empty { display: none; }
.admin-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin-table th { font-size: 12px; color: var(--muted); white-space: nowrap; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table small { color: var(--muted); }
.admin-table .empty-note { padding: 20px; }
.is-hidden-row { opacity: .5; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .auth, .acct-page { flex-direction: column; align-items: stretch; gap: 32px; }
  .auth__card, .account__side { flex: none; width: 100%; }
  .auth__title { font-size: 36px; }
  .qr-card { flex-direction: column; align-items: stretch; }
  .qr-card__img { align-self: center; }
  .reviews__list { grid-template-columns: 1fr; }
  .coupon-form__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .cart-label, .account-menu__name { display: none; }
  .nav-actions { gap: 12px; }
  #cart-button { padding: 0 16px; gap: 8px; }
  .auth { padding-top: 32px; padding-bottom: 56px; }
  .auth__title { font-size: 30px; letter-spacing: -1px; }
  .voucher { flex-wrap: wrap; padding: 0 0 12px; }
  .voucher__left { min-width: 100%; border-right: 0; border-bottom: 2px dashed var(--cream); }
  .voucher__body { padding: 0 14px; flex-basis: 100%; }
  .voucher .btn { margin-left: 14px; }
  .my-order { flex-wrap: wrap; }
  .spin-card { flex-wrap: wrap; }
  .stats { grid-template-columns: 1fr; }
  .admin-orders { grid-template-columns: 1fr; }
  .coupon-form__grid { grid-template-columns: 1fr; }
  .qr-card { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .spin-card--ready .spin-card__icon, .qr-card__dot, .admin-order--new { animation: none; }
}

/* ===== Trang hỗ trợ & chính sách ===== */
.help { display: flex; align-items: flex-start; gap: 32px; width: min(1280px, calc(100% - 48px)); margin: 0 auto; padding-bottom: 72px; }
.help__nav { position: sticky; top: 24px; flex: 0 0 240px; display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); }
.help__nav a { padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.help__nav a:hover { background: var(--blush); color: var(--red); }
.help__main { display: flex; flex-direction: column; gap: 24px; flex: 1; min-width: 0; }
.help__card { display: flex; flex-direction: column; gap: 12px; scroll-margin-top: 24px; font-size: 15px; line-height: 1.75; }
.help__card h3 { margin-top: 8px; font-weight: 700; font-size: 16px; }
.help__card ul, .help__card ol { display: flex; flex-direction: column; gap: 6px; padding-left: 22px; color: var(--muted); }
.help__card ul { list-style: disc; }
.help__card ol { list-style: decimal; }
.help__card p { color: var(--muted); }
.help__card a { font-weight: 700; color: var(--red); }
.help__card strong { color: var(--ink); }
.summary__terms a, .auth__terms a { font-weight: 700; color: var(--red); }
@media (max-width: 900px) {
  .help { flex-direction: column; }
  .help__nav { position: static; flex: none; width: 100%; flex-direction: row; flex-wrap: wrap; }
}
