/* ============================================================
   마이테이블 · Shared Components
   8종 layout이 공유하는 컴포넌트. 디자인 시스템의 일부.
   ============================================================ */

/* ---- TopNav ---- */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
}
.topnav__brand {
  font-family: var(--font-serif);
  font-size: var(--t-lg);
  letter-spacing: 0.04em;
  font-weight: 500;
}
.topnav__actions {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  font-size: var(--t-sm);
  color: var(--text-1);
}
.topnav__cart {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text-0);
}
.topnav__cart-count {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 500;
}

/* ---- Category Tabs ---- */
.cat-tabs {
  display: flex;
  gap: var(--s-6);
  padding: var(--s-4) var(--s-5);
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  font-family: var(--font-serif);
  font-size: var(--t-base);
  color: var(--text-2);
  white-space: nowrap;
  padding: var(--s-2) 0;
  border-bottom: 1px solid transparent;
  transition: color var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}
.cat-tab--active {
  color: var(--text-0);
  border-bottom-color: var(--accent);
}

/* ---- Menu Card (Grid / Mosaic) ---- */
.menu-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: transform var(--dur-base) var(--ease);
  cursor: pointer;
}
.menu-card:hover { transform: translateY(-2px); }
.menu-card:active { transform: scale(0.98); }

.menu-card__img {
  aspect-ratio: 1 / 1;
  width: 100%;
  object-fit: cover;
  background: var(--bg-2);
}
.menu-card__body {
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
.menu-card__name {
  font-family: var(--font-serif);
  font-size: var(--t-md);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.menu-card__desc {
  font-size: var(--t-xs);
  color: var(--text-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--s-2);
  min-height: calc(var(--t-xs) * 1.5 * 2);
}
.menu-card__price {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--accent);
  letter-spacing: 0.02em;
}

/* ---- Badge ---- */
.badge {
  display: inline-block;
  padding: 2px var(--s-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent);
  color: var(--bg-0);
  border-radius: var(--r-sm);
}
.badge--outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

/* ---- Placeholder (사진 자리 — 매장 컬러 따라 변함) ---- */
.placeholder {
  background: var(--bg-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  opacity: 0.55;
  color: var(--accent);
}

/* ---- Floating Cart Button (mobile) ---- */
/* 손님 페이지 layout root에 padding-bottom — cart FAB이 마지막 카드 가리지 않도록.
   gallery는 풀스크린이라 자체 처리. */
.layout-grid, .layout-list, .layout-editorial, .layout-poster,
.layout-mosaic, .layout-zigzag, .layout-bold {
  padding-bottom: 120px;
}

.cart-fab {
  position: fixed;
  right: var(--s-4);
  bottom: var(--s-5);
  width: 56px;
  height: 56px;
  border-radius: var(--r-full);
  background: var(--accent);
  color: var(--bg-0);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: var(--t-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  z-index: var(--z-cart);
  border: 0;
  cursor: pointer;
  position: fixed; /* keep */
}
.cart-fab__icon { font-size: 22px; line-height: 1; }
.cart-fab__count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--bg-0);
  color: var(--accent);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--accent);
}
@keyframes mt-cart-pulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.cart-fab--pulse { animation: mt-cart-pulse 0.42s ease-out; }
.cart-fab[disabled],
.cart-fab.is-disabled { opacity: 0.35; pointer-events: none; }

/* ---- intro scene (welcome 화면) ---- */
.mt-intro {
  position: fixed; inset: 0;
  z-index: var(--z-banner, 500);
  background: var(--bg-0);
  display: flex; flex-direction: column;
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.mt-intro--out { opacity: 0; transform: translateY(-20px); }
.mt-intro__hero {
  flex: 1;
  background-color: var(--bg-1);
  background-size: cover;
  background-position: center;
  min-height: 40vh;
}
.mt-intro__hero--fallback {
  display: flex; align-items: center; justify-content: center;
  font-size: 80px; opacity: 0.4;
}
.mt-intro__body {
  padding: var(--s-6) var(--s-5);
  text-align: center;
}
.mt-intro__name {
  font-family: var(--font-serif);
  font-size: 32px;
  margin: 0 0 var(--s-2);
  letter-spacing: -0.01em;
}
.mt-intro__tag {
  font-size: var(--t-base);
  color: var(--text-1);
  margin: 0 0 var(--s-3);
  line-height: 1.55;
}
.mt-intro__hours {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--text-2);
  margin: 0 0 var(--s-5);
}
.mt-intro__cta {
  padding: 14px 36px;
  background: var(--accent);
  color: var(--bg-0);
  border: 0;
  border-radius: 10px;
  font-size: var(--t-base);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

/* ---- 내 주문 상태 FAB ---- */
.order-status-fab {
  position: fixed;
  right: var(--s-4);
  bottom: calc(var(--s-4) * 3 + 56px + 48px);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg-1);
  border: 1px solid var(--border);
  color: var(--text-1);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: var(--z-cart);
  transition: color var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}
.order-status-fab:hover { color: var(--accent); border-color: var(--accent); }

/* ---- 메뉴 이미지 placeholder (모든 layout 공유) — 미니멀 단정 ---- */
.menu-card__img.placeholder,
.menu-row__img.placeholder,
.editorial__hero-img-fallback,
.zigzag__hero-img-fallback,
.gallery__img-fallback,
.mosaic__img:not(:has(img)),
.zz-row__img:not(:has(img)),
.bold-card__cutout:not(:has(img)) {
  background: linear-gradient(135deg, rgba(200,168,107,0.06), rgba(200,168,107,0.02));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: transparent;
}
.menu-card__img.placeholder::after,
.menu-row__img.placeholder::after,
.editorial__hero-img-fallback::after,
.zigzag__hero-img-fallback::after,
.gallery__img-fallback::after,
.mosaic__img:not(:has(img))::after,
.zz-row__img:not(:has(img))::after,
.bold-card__cutout:not(:has(img))::after {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent);
  opacity: 0.3;
}

/* ---- 메뉴 옵션 텍스트 (모든 layout 공유) ---- */
.menu-options {
  font-size: var(--t-xs);
  color: var(--text-2);
  margin: 4px 0;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

/* ---- 직원 호출 FAB ---- */
.call-fab {
  position: fixed;
  right: var(--s-4);
  bottom: calc(var(--s-4) * 2 + 56px);
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--bg-1);
  border: 1px solid var(--border);
  color: var(--text-1);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: var(--z-cart);
  transition: color var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}
.call-fab:hover { color: var(--accent); border-color: var(--accent); }

/* ---- Bottom Sheet (cart / call 공용) ---- */
.mt-sheet {
  position: fixed; inset: 0;
  z-index: var(--z-modal, 300);
  background: rgba(0,0,0,0.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.mt-sheet__panel {
  background: var(--bg-1);
  color: var(--text-0);
  width: 100%; max-width: 520px;
  border-radius: 16px 16px 0 0;
  padding: var(--s-5);
  max-height: 85vh; overflow-y: auto;
}
.mt-sheet__head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--s-4);
}
.mt-sheet__title { margin: 0; font-family: var(--font-serif); font-size: var(--t-lg); }
.mt-sheet__close {
  background: transparent; border: 0; color: var(--text-2);
  font-size: 20px; cursor: pointer; padding: 4px 8px;
}
.mt-sheet__empty {
  color: var(--text-2); text-align: center; padding: var(--s-6) 0;
}

/* cart rows */
.mt-cart__list { list-style: none; margin: 0; padding: 0; }
.mt-cart__row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--s-3);
  align-items: center;
  padding: var(--s-3) 0;
}
.mt-cart__row + .mt-cart__row { border-top: 1px solid var(--border); }
.mt-cart__name { font-size: var(--t-base); }
.mt-cart__qty { display: flex; align-items: center; gap: var(--s-2); }
.mt-cart__qty button {
  width: 44px; height: 44px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-0);
  cursor: pointer;
  font-size: 18px;
}
.mt-cart__qty span { min-width: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.mt-cart__price { font-family: var(--font-mono); color: var(--text-1); min-width: 80px; text-align: right; }
.mt-cart__total {
  display: flex; justify-content: space-between;
  padding: var(--s-4) 0 var(--s-3);
  font-size: var(--t-md);
  font-weight: 600;
}
.mt-cart__note {
  width: 100%;
  margin: 0 0 var(--s-3);
  padding: var(--s-3);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-0);
  font-family: inherit;
  font-size: var(--t-sm);
  resize: vertical;
  min-height: 56px;
  box-sizing: border-box;
}
.mt-cart__phone {
  width: 100%;
  margin: 0 0 var(--s-3);
  padding: var(--s-3);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-0);
  font-family: inherit;
  font-size: var(--t-sm);
  box-sizing: border-box;
  letter-spacing: 0.02em;
}
.mt-cart__phone:focus { border-color: var(--accent); outline: none; }
.mt-cart__phone:invalid:not(:placeholder-shown) { border-color: #c95a5a; }
.mt-cart__submit {
  width: 100%;
  padding: var(--s-4);
  background: var(--accent);
  color: var(--bg-0);
  border: 0;
  border-radius: 10px;
  font-size: var(--t-base);
  font-weight: 600;
  cursor: pointer;
}
.mt-cart__submit:disabled { opacity: 0.5; cursor: progress; }

/* call sheet */
.mt-call__grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.mt-call__btn {
  min-height: 56px;
  padding: var(--s-4) var(--s-2);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-0);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--t-sm);
}
.mt-call__btn:hover { background: var(--accent); color: var(--bg-0); }
.mt-call__btn:disabled { opacity: 0.5; cursor: wait; }

/* toast */
.mt-toast {
  position: fixed;
  bottom: var(--s-5);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast, 400);
  padding: var(--s-3) var(--s-5);
  border-radius: 8px;
  font-size: var(--t-sm);
  background: var(--accent);
  color: var(--bg-0);
  box-shadow: var(--shadow-md);
}
.mt-toast--err { background: #c95a5a; color: #fff; }

/* ---- sheet subtitle ---- */
.mt-sheet__sub {
  font-size: var(--t-xs);
  color: var(--text-2);
  margin-top: 2px;
  font-family: var(--font-mono);
}

/* ---- success card (주문 후) ---- */
.mt-success { text-align: center; padding: var(--s-5) 0 var(--s-3); }
.mt-success__icon {
  width: 56px; height: 56px;
  margin: 0 auto var(--s-3);
  border-radius: var(--r-full);
  background: var(--accent);
  color: var(--bg-0);
  display: grid; place-items: center;
  font-size: 28px;
}
.mt-success h3 { margin: 0 0 var(--s-1); font-family: var(--font-serif); font-size: var(--t-lg); }
.mt-success .order-no {
  margin: var(--s-1) 0 var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-base);
  color: var(--text-1);
  letter-spacing: 0.08em;
}
.mt-success small { color: var(--text-2); font-size: var(--t-xs); }

/* ---- spinner (3 dot) ---- */
.mt-spinner {
  position: fixed; inset: 0;
  display: flex; gap: 8px;
  align-items: center; justify-content: center;
  background: var(--bg-0);
  z-index: var(--z-modal, 300);
}
.mt-spinner__dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  animation: mt-dot 1.2s infinite ease-in-out both;
}
.mt-spinner__dot:nth-child(2) { animation-delay: 0.18s; }
.mt-spinner__dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes mt-dot {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

/* ---- 진입 안내 banner (token 없음 등) ---- */
.mt-banner {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: var(--z-banner, 500);
  padding: 10px 16px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.2px;
}
.mt-banner--warn {
  background: var(--bg-1);
  color: var(--text-1);
  border-bottom: 1px solid var(--accent);
}
.mt-banner--err {
  background: var(--bg-1);
  color: var(--text-1);
  border-bottom: 1px solid var(--danger, #c95a5a);
}
body.mt-has-banner { padding-top: 40px; }

/* ---- 다국어 토글 (KO/EN) — TopNav 아래로 배치 (overlap 방지) ---- */
.mt-lang {
  position: fixed;
  top: 64px;
  right: var(--s-3);
  z-index: var(--z-cart);
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.mt-lang button {
  background: transparent;
  border: 0;
  color: var(--text-2);
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}
.mt-lang button.is-on { background: var(--accent); color: var(--bg-0); }
body.mt-has-banner .mt-lang { top: calc(var(--s-3) + 40px); }

/* ---- PWA install banner (prod 활성 시) ---- */
.mt-install-banner {
  position: fixed; left: 14px; right: 14px; bottom: 14px;
  z-index: var(--z-banner, 500);
  display: flex; gap: 10px; align-items: center;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.mt-install-banner__text { flex: 1; font-size: 13px; color: var(--text-1); line-height: 1.5; }
.mt-install-banner__install {
  padding: 7px 14px;
  background: var(--accent);
  color: var(--bg-0);
  border: 0; border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
}
.mt-install-banner__dismiss {
  background: transparent; border: 0;
  color: var(--text-2);
  font-size: 20px;
  cursor: pointer; padding: 4px 8px;
}

/* ---- 손님 footer (1줄) ---- */
.mt-foot {
  position: relative;
  padding: var(--s-5) var(--s-4) var(--s-7);
  text-align: center;
  font-size: var(--t-xs);
  color: var(--text-2);
}
.mt-foot a { color: var(--text-2); text-decoration: none; margin: 0 6px; }
.mt-foot a:hover { color: var(--text-0); }

/* ---- signup layout 미리보기 (mini mockup) ---- */
.layout-preview {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg-2);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  margin-bottom: var(--s-2);
}
.layout-preview::before,
.layout-preview::after {
  content: '';
  position: absolute;
  background: var(--text-2);
  opacity: 0.55;
}
/* grid: 9개 사각 */
.layout-preview--grid {
  background-image:
    radial-gradient(var(--text-2) 1.5px, transparent 2px),
    radial-gradient(var(--text-2) 1.5px, transparent 2px);
  background-size: 33% 33%, 33% 33%;
  background-position: 0 0, 16.5% 16.5%;
}
.layout-preview--grid::before { display: none; }
.layout-preview--grid::after { display: none; }
/* list: 가로 줄 4개 */
.layout-preview--list { background-image: repeating-linear-gradient(180deg, transparent 0 12%, var(--text-2) 12% 14%, transparent 14% 25%); opacity: 0.7; }
.layout-preview--list::before, .layout-preview--list::after { display: none; }
/* editorial: 큰 hero + 줄 */
.layout-preview--editorial::before { left: 8%; right: 8%; top: 8%; height: 40%; background: var(--text-2); }
.layout-preview--editorial::after { left: 8%; right: 8%; bottom: 8%; height: 32%; background: var(--text-2); opacity: 0.3; }
/* poster: 흩뿌리기 */
.layout-preview--poster {
  background-image:
    radial-gradient(circle at 22% 28%, var(--text-2) 0 12%, transparent 12.5%),
    radial-gradient(circle at 72% 38%, var(--text-2) 0 10%, transparent 10.5%),
    radial-gradient(circle at 40% 70%, var(--text-2) 0 14%, transparent 14.5%),
    radial-gradient(circle at 82% 75%, var(--text-2) 0 9%, transparent 9.5%);
}
.layout-preview--poster::before, .layout-preview--poster::after { display: none; }
/* mosaic: 불규칙 사각 */
.layout-preview--mosaic {
  background-image:
    linear-gradient(var(--text-2), var(--text-2)),
    linear-gradient(var(--text-2), var(--text-2)),
    linear-gradient(var(--text-2), var(--text-2));
  background-size: 35% 45%, 25% 30%, 30% 30%;
  background-position: 10% 10%, 55% 15%, 30% 60%;
  background-repeat: no-repeat;
  opacity: 0.7;
}
.layout-preview--mosaic::before, .layout-preview--mosaic::after { display: none; }
/* zigzag: 좌우 교차 */
.layout-preview--zigzag::before { left: 8%; top: 12%; width: 40%; height: 22%; }
.layout-preview--zigzag::after { right: 8%; bottom: 12%; width: 40%; height: 22%; }
/* bold: 큰 단일 */
.layout-preview--bold::before { left: 12%; right: 12%; top: 12%; bottom: 38%; background: var(--text-2); }
.layout-preview--bold::after { left: 12%; right: 12%; bottom: 12%; height: 18%; background: var(--text-2); opacity: 0.5; }
/* gallery: 풀스크린 단일 + nav */
.layout-preview--gallery::before { left: 8%; right: 8%; top: 8%; bottom: 22%; background: var(--text-2); }
.layout-preview--gallery::after { left: 35%; right: 35%; bottom: 8%; height: 6%; background: var(--text-2); }

/* ---- KDS audio gate (소리 켜기 오버레이) ---- */
.kds-audio-gate {
  position: fixed; inset: 0;
  z-index: var(--z-modal, 300);
  background: rgba(0,0,0,0.92);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: var(--s-4);
  color: var(--text-0);
}
.kds-audio-gate button {
  padding: 18px 36px;
  background: var(--accent);
  color: var(--bg-0);
  border: 0;
  border-radius: 12px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
}
.kds-audio-gate p { color: var(--text-2); font-size: 14px; }

/* ---- Frame (mockup wrapper · 태블릿/모바일 비교) ---- */
.compare {
  min-height: 100vh;
  padding: var(--s-5);
  background: #050505;
  display: flex;
  gap: var(--s-6);
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
}
.frame {
  background: var(--bg-1);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.frame__label {
  padding: var(--s-3) var(--s-4);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--text-2);
  background: #050505;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
}
.frame__viewport { background: var(--bg-0); overflow: hidden; }
.frame--tablet .frame__viewport { width: 1024px; height: 768px; }
.frame--mobile .frame__viewport { width: 390px; height: 760px; }
.frame__inner { width: 100%; height: 100%; overflow-y: auto; overflow-x: hidden; position: relative; }

/* cart row 안 옵션 라벨 표시 */
.mt-cart__opts {
  font-size: var(--t-xs);
  color: var(--text-2);
  margin-top: 2px;
  letter-spacing: 0.01em;
}

/* ---- 옵션 picker (체크박스 시트) — 메뉴 카드 옵션 있을 때 ---- */
.mt-opt__list { list-style: none; margin: 0 0 var(--s-3); padding: 0; }
.mt-opt__row { border-bottom: 1px solid var(--border); }
.mt-opt__row:last-child { border-bottom: 0; }
.mt-opt__row label {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) 0; cursor: pointer;
  font-size: var(--t-sm); min-height: 44px;
}
.mt-opt__row input[type=checkbox] {
  width: 20px; height: 20px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.mt-opt__label { flex: 1; color: var(--text-0); }
.mt-opt__delta {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--accent);
  letter-spacing: 0.02em;
}
