/* ================================================================
   components.css — Toast, POS, conversations, history, FAB cart,
                    conv drawer, feature forms, FAQ, platform, admin
   ================================================================ */

/* ---- Toast ---- */
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 150; max-width: min(420px, calc(100% - 32px)); padding: 14px 16px; color: white; background: var(--ink); border-radius: 12px; box-shadow: 0 14px 34px rgba(17, 24, 39, .2); font-size: 14px; font-weight: 700; line-height: 1.45; opacity: 0; pointer-events: none; transform: translateY(14px); transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #8f2f2a; }

/* ---- POS Mode ---- */
body.pos-mode .side-panel,
body.pos-mode .topbar,
body.pos-mode .order-panel,
body.pos-mode .mobile-nav,
body.pos-mode .fab-cart { display: none !important; }
body.pos-mode .app-shell { padding: 0; }
body.pos-mode .main-stage { min-height: 100vh; padding: 0; }
body.pos-mode .guided-footer { right: 0; left: 0; }
.pos-page { display: grid; min-height: 100vh; place-items: center; padding: 36px; background: radial-gradient(circle at top, #fff7eb, #f6f4ee 58%, #ece5da); }
.pos-card, .pos-launcher { width: min(940px, 100%); padding: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); }
.pos-card { display: grid; max-width: 460px; gap: 14px; text-align: center; }
.pos-card h1, .pos-head h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(34px, 5vw, 58px); font-weight: 500; letter-spacing: -.055em; }
.pos-card p, .pos-head p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.pos-login-form input { width: 100%; min-height: 60px; padding: 0 18px; margin-top: 8px; text-align: center; letter-spacing: .25em; border: 1.5px solid var(--line); border-radius: 15px; font-size: 22px; font-weight: 900; }
.pos-kiosk-logo { display: inline-grid; width: 86px; height: 86px; place-items: center; justify-self: center; padding: 7px; background: #fff; border-radius: 24px; box-shadow: 0 10px 26px rgba(54,44,30,.12); }
.pos-kiosk-logo img { width: 100%; height: 100%; object-fit: contain; }
.pos-head { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center; margin-bottom: 26px; }
.pos-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.pos-mode-card { display: grid; min-height: 210px; align-content: center; justify-items: start; gap: 12px; padding: 22px; text-align: left; background: #fbf8f1; border: 1px solid #eee5d7; border-radius: 22px; box-shadow: 0 12px 30px rgba(54,44,30,.06); }
.pos-mode-card strong { font-size: 22px; }
.pos-mode-card small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.pos-mode-icon { display: grid; width: 52px; height: 52px; place-items: center; color: white; background: var(--accent); border-radius: 16px; font-size: 20px; font-weight: 900; }
.pos-mode-card:nth-child(2) .pos-mode-icon { background: var(--ink); }
.pos-mode-card:nth-child(3) .pos-mode-icon { background: #8a3ffc; }
.pos-new-order { margin-top: 18px; }
.livekit-remote-audio { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.mobile-nav { display: none; }

/* ---- Conversations ---- */
.conversations-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.conversations-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.conversations-head strong { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.conversations-list { display: grid; gap: 4px; max-height: 180px; overflow: auto; }
.conversation-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; font-size: 10px; font-weight: 700; text-align: left; background: transparent; color: var(--ink); cursor: pointer; }
.conversation-item:hover, .conversation-item.active { background: var(--accent-soft); color: var(--accent-dark); }
.conversation-item .conv-type { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; background: var(--line); font-size: 8px; flex: 0 0 20px; }
.conversation-item.active .conv-type { background: var(--accent); color: white; }
.conversation-item .conv-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-item .conv-date { color: var(--muted); font-size: 8px; flex: 0 0 auto; }

/* ---- Conversations Button (mobile topbar) ---- */
.conversations-button { position: relative; display: none; width: 38px; height: 38px; place-items: center; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 11px; }
.conversations-button svg { width: 17px; }
.conversations-button span { position: absolute; top: -5px; right: -4px; display: grid; min-width: 17px; height: 17px; place-items: center; padding: 0 4px; color: white; background: var(--accent); border: 2px solid var(--paper); border-radius: 99px; font-size: 7px; font-weight: 900; }

/* ---- Conversation Drawer (mobile) ---- */
.conv-overlay { position: fixed; inset: 0; z-index: 58; background: rgba(23, 23, 20, .35); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.conv-overlay.open { opacity: 1; pointer-events: auto; }
.conv-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 59; display: flex; width: min(320px, 85vw); flex-direction: column; padding: 16px; background: var(--surface); border-left: 1px solid var(--line); box-shadow: -10px 0 40px rgba(23, 23, 20, .15); transform: translateX(105%); transition: transform .35s cubic-bezier(.32, .72, .35, 1); }
.conv-drawer.open { transform: translateX(0); }
.conv-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.conv-drawer-head strong { font-size: 14px; }
.conv-drawer-head button { width: 32px; height: 32px; display: grid; place-items: center; color: var(--muted); background: #f0ede5; border-radius: 50%; font-size: 18px; }
.conv-new-btn { width: 100%; min-height: 40px; margin-bottom: 12px; color: var(--accent); background: var(--accent-soft); border-radius: 10px; font-size: 11px; font-weight: 800; }
.conv-drawer-list { flex: 1; overflow: auto; display: grid; gap: 4px; }
.conv-drawer-list .conversation-item { padding: 10px; border-radius: 10px; font-size: 11px; }

/* ---- History ---- */
.history-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.history-tabs button { padding: 8px 14px; border-radius: 10px; font-size: 10px; font-weight: 800; background: transparent; color: var(--muted); }
.history-tabs button.active { background: var(--accent-soft); color: var(--accent-dark); }
.history-content.hidden { display: none; }
.history-order { padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; }
.history-order strong { font-size: 12px; }
.history-order small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.history-conversation { padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.history-conversation .conv-icon { width: 28px; height: 28px; display: grid; place-items: center; background: var(--accent-soft); border-radius: 8px; font-size: 10px; }

/* ---- FAB Cart (mobile) ---- */
.fab-cart { position: fixed; right: 14px; bottom: 148px; z-index: 55; display: flex; height: 40px; align-items: center; gap: 8px; padding: 0 14px; color: white; background: var(--accent); border-radius: 99px; box-shadow: 0 6px 20px rgba(239, 90, 47, .4); transition: transform .25s ease, opacity .25s ease; cursor: pointer; font-size: 11px; font-weight: 800; }
.fab-cart.hidden { transform: scale(0); opacity: 0; pointer-events: none; }
.fab-cart svg { width: 18px; height: 18px; stroke-width: 2; }
.fab-cart span { display: grid; min-width: 18px; height: 18px; place-items: center; padding: 0 4px; color: var(--accent); background: white; border-radius: 99px; font-size: 9px; font-weight: 900; }
.fab-cart.popped { animation: fabPop .4s ease; }
@keyframes fabPop { 0% { transform: scale(1); } 40% { transform: scale(1.15); } 70% { transform: scale(0.95); } 100% { transform: scale(1); } }
.fab-cart-overlay { position: fixed; inset: 0; z-index: 56; background: rgba(23, 23, 20, .35); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.fab-cart-overlay.open { opacity: 1; pointer-events: auto; }
.fab-cart-sheet { position: fixed; right: 0; bottom: 0; left: 0; z-index: 57; display: flex; max-height: 75vh; flex-direction: column; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: 0 -10px 40px rgba(23, 23, 20, .18); transform: translateY(105%); transition: transform .35s cubic-bezier(.32, .72, .35, 1); }
.fab-cart-sheet.open { transform: translateY(0); }
.fab-cart-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.fab-cart-sheet-head strong { font-size: 14px; }
.fab-cart-sheet-head button { width: 32px; height: 32px; display: grid; place-items: center; color: var(--muted); background: #f0ede5; border-radius: 50%; font-size: 18px; }
.fab-cart-lines { flex: 1; overflow: auto; display: grid; gap: 8px; margin-bottom: 12px; }
.fab-cart-foot { padding-top: 10px; border-top: 1px solid var(--line); }
.fab-cart-foot .total-row { margin-bottom: 12px; }
.fab-cart-foot .primary-button { margin-top: 0; }

/* ---- No Food Ordering ---- */
body.no-food-ordering .app-shell { padding-right: 0; }
body.no-food-ordering .order-panel { display: none !important; }

/* ---- Feature Forms ---- */
.feature-form-page { max-width: 640px; }
.feature-form { display: grid; gap: 16px; padding: 8px 0 32px; }
.feature-form textarea { width: 100%; min-height: 110px; padding: 11px 14px; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 12px; outline: none; resize: vertical; }
.feature-form textarea:focus { border-color: #e5ac9a; box-shadow: 0 0 0 4px rgba(239, 90, 47, .08); }
.feature-submit { position: relative; min-height: 52px; }
.feature-submit .btn-spinner { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; }
.feature-submit.is-loading .btn-text { opacity: 0; }
.feature-submit.is-loading .btn-spinner { opacity: 1; }
.feature-submit .btn-spinner svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; animation: spin .8s linear infinite; }

/* ---- FAQ ---- */
.faq-list { display: grid; gap: 10px; }
.faq-item { padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.faq-item summary { cursor: pointer; font-weight: 800; font-size: 13px; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; float: right; color: var(--accent); font-weight: 900; }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.faq-empty { padding: 28px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 16px; }

/* ---- Platform Sticker ---- */
.platform-sticker {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 45;
  max-width: min(320px, calc(100vw - 32px));
  padding: 12px 16px;
  color: #fff;
  background: var(--ink);
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(23, 23, 20, .22);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  text-align: left;
}
.platform-sticker:hover { transform: translateY(-1px); }
.platform-sticker span { display: block; }
.platform-sticker-dialog { width: min(420px, calc(100% - 24px)); padding: 0; border: 0; border-radius: 24px; overflow: hidden; }
.platform-sticker-dialog::backdrop { background: rgba(23, 23, 20, .45); backdrop-filter: blur(6px); }
.platform-sticker-dialog form { position: relative; padding: 28px 24px 24px; }
.platform-sticker-dialog h2 { margin: 6px 0 10px; font-family: Georgia, serif; font-size: 24px; font-weight: 500; letter-spacing: -.04em; }
.platform-sticker-note { margin: 0 0 18px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.platform-contact-links { display: grid; gap: 10px; }
.platform-contact-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}
.platform-contact-links a:hover { border-color: #e5ac9a; background: var(--accent-soft); }

/* ---- Admin Banner ---- */
.admin-banner { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 1rem; font-size: 13px; font-weight: 700; background: var(--accent); color: #fff; }
.admin-banner.hidden { display: none !important; }
.admin-banner-link { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.admin-banner-link:hover { text-decoration: underline; }
.admin-banner-link svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.admin-banner-close { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; color: inherit; background: transparent; border-radius: 6px; font-size: 18px; line-height: 1; }
.admin-banner-close:hover { background: rgba(255,255,255,0.2); }

/* ---- Install Button ---- */
.install-button { transition: transform .2s ease; }
.install-button:hover { transform: translateY(-1px); }
.install-button:not(.hidden) { animation: rise .3s ease both; }

/* ---- Responsive ---- */
@media (min-width: 1281px) {
  .fab-cart, .fab-cart-overlay, .fab-cart-sheet { display: none !important; }
}
@media (max-width: 1280px) {
  .conversations-button { display: grid; }
  .conversations-section { display: none; }
}
