/* ══════════════════════════════════════════════════════
   Ontable Customer — Main Stylesheet
   ══════════════════════════════════════════════════════ */

:root {
  --primary:        #4C1D95;
  --primary-mid:    #7C3AED;
  --primary-light:  #EDE9FE;
  --gold:           #FAC775;
  --success:        #059669;
  --success-light:  #D1FAE5;
  --warning:        #D97706;
  --warning-light:  #FEF3C7;
  --danger:         #DC2626;
  --danger-light:   #FEE2E2;
  --info:           #1D4ED8;
  --info-light:     #DBEAFE;
  --surface:        #FFFFFF;
  --bg:             #F7F6F3;
  --border:         #E5E7EB;
  --text-1:         #111827;
  --text-2:         #6B7280;
  --text-3:         #9CA3AF;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  font-family: 'Sarabun', 'Noto Sans Thai', sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
}

/* ── Page wrapper — mobile-first centered ── */
.page-wrapper {
  max-width: 390px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

/* ── Topbar ── */
.topbar {
  background: linear-gradient(135deg, #4C1D95, #7C3AED);
  position: sticky; top: 0; z-index: 100;
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 8px rgba(76,29,149,.3);
}
.topbar-logo { color: #fff; font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.topbar-logo span { color: var(--gold); }
.topbar-sub { color: rgba(255,255,255,.75); font-size: 11px; }

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; z-index: 100;
  max-width: 390px; margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 8px 4px 6px;
  text-decoration: none; color: var(--text-3);
  font-size: 10px; font-weight: 500;
  position: relative; gap: 2px;
  transition: color .15s;
}
.nav-item i { font-size: 22px; display: block; }
.nav-item.active, .nav-item:active { color: var(--primary); }

/* ── Content area ── */
.content { padding-top: 0; padding-bottom: 80px; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-body { padding: 16px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; font-weight: 700; border-radius: 12px;
  padding: 12px 20px; font-size: 15px; cursor: pointer;
  border: none; transition: all .15s; text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #3b1578; }
.btn-secondary { background: #F3F4F6; color: var(--text-1); border: 1px solid var(--border); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 15px 24px; font-size: 16px; border-radius: 14px; }

/* ── Inputs ── */
.form-control {
  background: #F9FAFB; border: 1.5px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
  font-size: 15px; width: 100%; color: var(--text-1);
  transition: border-color .15s;
  font-family: inherit;
}
.form-control:focus {
  outline: none; border-color: var(--primary-mid);
  background: #fff; box-shadow: 0 0 0 3px rgba(124,58,237,.1);
}
.form-label { font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; display: block; }
.form-group { margin-bottom: 16px; }
.form-error { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* ── Section Title ── */
.section-title {
  font-size: 16px; font-weight: 800; color: var(--text-1);
  margin: 0 0 12px;
}
.section-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* ── Badge / Pill ── */
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-gray    { background: #F3F4F6; color: var(--text-2); }

/* ── Shop Card ── */
.shop-card { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.shop-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.shop-img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover;
  background: linear-gradient(135deg, #EDE9FE, #DDD6FE);
}
.shop-img-placeholder {
  width: 100%; aspect-ratio: 16/9;
  background: linear-gradient(135deg, #EDE9FE, #DDD6FE);
  display: flex; align-items: center; justify-content: center;
}

/* ── Status Step Tracker ── */
.step-track { display: flex; align-items: flex-start; gap: 0; }
.step-item { flex: 1; display: flex; flex-direction: column; align-items: center; }
.step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
  border: 2px solid var(--border);
  background: #fff; color: var(--text-3);
}
.step-dot.done { background: var(--success); border-color: var(--success); color: #fff; }
.step-dot.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.step-line { flex: 1; height: 2px; background: var(--border); margin-top: 13px; }
.step-line.done { background: var(--success); }
.step-label { font-size: 10px; text-align: center; color: var(--text-3); margin-top: 4px; line-height: 1.3; }
.step-label.done { color: var(--success); font-weight: 700; }
.step-label.active { color: var(--primary); font-weight: 700; }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 2px solid var(--border); background: #fff; }
.tab-item,
.tab-btn {
  flex: 1; text-align: center; padding: 11px 4px;
  font-size: 13px; font-weight: 600; color: var(--text-3);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all .15s; background: none; border-top: none; border-left: none; border-right: none;
  outline: none;
}
.tab-item.active,
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Stepper ── */
.stepper { display: flex; align-items: center; margin-bottom: 20px; }
.stepper-step {
  display: flex; flex-direction: column; align-items: center; flex: 1;
}
.stepper-num {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--border); color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
}
.stepper-num.active { background: var(--primary); color: #fff; }
.stepper-num.done { background: var(--success); color: #fff; }
.stepper-label { font-size: 10px; color: var(--text-3); margin-top: 4px; font-weight: 600; }
.stepper-label.active { color: var(--primary); }
.stepper-label.done { color: var(--success); }
.stepper-line { flex: 1; height: 2px; background: var(--border); margin-bottom: 18px; }
.stepper-line.done { background: var(--success); }

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: 16px;
  padding: 32px 20px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary-mid); background: var(--primary-light);
}
.upload-zone input[type=file] { display: none; }

/* ── Timeline ── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 18px; }
.timeline-dot {
  position: absolute; left: -24px; top: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--primary); border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--primary);
}
.timeline-dot.gray { background: var(--text-3); box-shadow: 0 0 0 2px var(--text-3); }
.timeline-dot.green { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-time { font-size: 11px; color: var(--text-3); }
.timeline-text { font-size: 13px; font-weight: 600; color: var(--text-1); margin-top: 2px; }
.timeline-by { font-size: 11px; color: var(--text-3); }

/* ── Chat Bubbles ── */
.chat-list { display: flex; flex-direction: column; gap: 12px; }
.bubble-wrap { display: flex; gap: 8px; }
.bubble-wrap.mine { flex-direction: row-reverse; }
.bubble-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.bubble {
  max-width: 75%; padding: 10px 14px; border-radius: 16px;
  font-size: 13px; line-height: 1.5;
}
.bubble.theirs { background: #F3F4F6; color: var(--text-1); border-bottom-left-radius: 4px; }
.bubble.mine { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.bubble-time { font-size: 10px; color: var(--text-3); margin-top: 4px; }
.bubble-wrap.mine .bubble-time { text-align: right; }

/* ── Price Table ── */
.price-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; }
.price-row + .price-row { border-top: 1px solid var(--border); }
.price-total { font-weight: 800; font-size: 16px; color: var(--primary); }
.price-deposit { font-weight: 700; color: var(--warning); }

/* ── Hero Gradient Banner ── */
.hero-banner {
  background: linear-gradient(135deg, #4C1D95 0%, #7C3AED 50%, #A855F7 100%);
  padding: 28px 20px 80px; position: relative; overflow: hidden;
  color: #fff;
}
.hero-banner::before {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.hero-banner::after {
  content: ''; position: absolute; left: -20px; bottom: -40px;
  width: 150px; height: 150px; border-radius: 50%;
  background: rgba(255,255,255,.04);
}

/* ── Floating search card ── */
.search-float {
  margin: -44px 16px 0; position: relative; z-index: 10;
}

/* ── Bottom Sheet / Modal ── */
.modal-backdrop,
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 200; display: flex; align-items: flex-end;
  justify-content: center;
}
.modal-sheet {
  background: #fff; border-radius: 20px 20px 0 0;
  width: 100%; max-width: 390px; padding: 20px 16px 32px;
  animation: slideUp .25s ease;
  max-height: 90vh; overflow-y: auto;
}
.modal-center {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 20px; max-width: 390px; margin: 0 auto;
}
.modal-box {
  background: #fff; border-radius: 20px;
  width: 100%; padding: 24px 20px;
  animation: fadeIn .2s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fadeIn  { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }

/* ── Sheet handle ── */
.sheet-handle {
  width: 36px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 0 auto 16px;
}

/* ── Empty state ── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state i { font-size: 48px; color: var(--border); }
.empty-state h3 { font-size: 16px; font-weight: 800; color: var(--text-2); margin: 12px 0 6px; }
.empty-state p { font-size: 13px; color: var(--text-3); }

/* ── Horizontal Scroll ── */
.hscroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll-item { flex-shrink: 0; }

/* ── Guarantee strip ── */
.guarantee-strip {
  background: linear-gradient(90deg, #059669, #047857);
  color: #fff; padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 700;
}

/* ── Input with icon ── */
.input-icon { position: relative; }
.input-icon i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); font-size: 18px; pointer-events: none;
}
.input-icon .form-control { padding-left: 38px; }

/* ── Qty stepper ── */
.qty-stepper {
  display: inline-flex; align-items: center; gap: 0;
  border: 1.5px solid var(--border); border-radius: 12px; overflow: hidden;
}
.qty-btn {
  width: 38px; height: 38px; background: #F9FAFB;
  border: none; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-weight: 800;
  transition: background .15s;
}
.qty-btn:hover { background: var(--primary-light); }
.qty-val {
  width: 48px; text-align: center; font-size: 16px;
  font-weight: 800; border: none; background: #fff;
}

/* ── Success checkmark animation ── */
.success-checkmark {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--success-light);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  animation: popIn .4s cubic-bezier(.175,.885,.32,1.275);
}
@keyframes popIn { from { transform: scale(0); } to { transform: scale(1); } }

/* ── Page header (back + title) ── */
.page-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 10px;
  background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.back-btn {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary-light); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-size: 18px; flex-shrink: 0;
  text-decoration: none;
}
.page-title { font-size: 16px; font-weight: 800; color: var(--text-1); flex: 1; }

/* ── Notice / Info box ── */
.notice {
  border-radius: 12px; padding: 12px 14px;
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13px; line-height: 1.5;
}
.notice-warning { background: var(--warning-light); color: #78350F; }
.notice-info    { background: var(--info-light);    color: #1E3A8A; }
.notice-success { background: var(--success-light); color: #064E3B; }
.notice-danger  { background: var(--danger-light);  color: #7F1D1D; }
.notice i { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

/* ── Category icon grid ── */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cat-item {
  background: #fff; border-radius: 14px; border: 1.5px solid var(--border);
  padding: 14px 8px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.cat-item:hover, .cat-item.active { border-color: var(--primary); background: var(--primary-light); }
.cat-icon { font-size: 26px; margin-bottom: 6px; }
.cat-label { font-size: 12px; font-weight: 700; color: var(--text-2); }
.cat-item.active .cat-label { color: var(--primary); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Misc ── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.divider-thick { height: 8px; background: var(--bg); margin: 16px -16px; }
.text-muted { color: var(--text-3); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.fw-bold { font-weight: 700; }
.fw-800  { font-weight: 800; }
.gap-8   { gap: 8px; }
.p-16    { padding: 16px; }
.px-16   { padding-left: 16px; padding-right: 16px; }
.py-12   { padding-top: 12px; padding-bottom: 12px; }
.mt-16   { margin-top: 16px; }
.mb-16   { margin-bottom: 16px; }
.flex    { display: flex; }
.flex-col{ flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full  { width: 100%; }
