/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Tokens ────────────────────────────────────────────── */
:root {
  --bg:           #f5f3ee;
  --bg-alt:       #ede9e1;
  --surface:      #ffffff;
  --ink:          #1a1814;
  --ink-2:        #3d3a33;
  --muted:        #7a7568;
  --border:       rgba(0,0,0,0.08);
  --border-solid: #dedad3;
  --shadow:       0 2px 14px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.05);
  --shadow-drop:  0 8px 32px rgba(0,0,0,0.13), 0 0 0 1px rgba(0,0,0,0.07);
  --green:        #157a3c;
  --green-mid:    #1a9e4e;
  --green-light:  #e8f4ed;
  --blue:         #1a4fa0;
  --blue-light:   #e8eef8;
  --amber:        #92640a;
  --amber-light:  #fdf3e0;
  --table-bg:     #f0faf4;
  --table-border: #b6dfc6;
  --table-text:   #0f5c2c;
  --radius-card:  18px;
  --radius-tag:   6px;
}

/* ── Body & Texture ────────────────────────────────────── */
body {
  font-family: 'Noto Sans HK', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  position: relative;
}

/* grain overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 999; opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* dot grid */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background-image: radial-gradient(circle, rgba(0,0,0,0.065) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ── Header ────────────────────────────────────────────── */
header {
  position: relative; z-index: 10;
  padding: 48px 24px 28px;
  max-width: 1140px; margin: 0 auto;
}

.header-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 12px;
}

h1 {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(28px, 5vw, 44px); font-weight: 700;
  line-height: 1.1; letter-spacing: -0.02em;
}
h1 span { color: var(--green); }

.header-sub { margin-top: 10px; color: var(--muted); font-size: 15px; }

/* ── Filter Bar ────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 28px;
}

/* each dropdown trigger */
.filter-dropdown {
  position: relative;
}

.filter-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-solid);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
}

.filter-trigger:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.filter-trigger.has-selection {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.filter-trigger-icon {
  width: 14px; height: 14px;
  opacity: 0.6;
  flex-shrink: 0;
}

.filter-trigger-label { flex: 1; }

.filter-trigger-count {
  background: var(--green);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.6;
}

.filter-trigger.has-selection .filter-trigger-count {
  background: rgba(255,255,255,0.25);
}

.filter-chevron {
  width: 12px; height: 12px;
  opacity: 0.5;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.filter-dropdown.open .filter-chevron {
  transform: rotate(180deg);
}

/* ── Dropdown Panel ────────────────────────────────────── */
.filter-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 280px;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-drop);
  z-index: 100;
  overflow: hidden;
  display: none;
  animation: panelIn 0.18s ease both;
}

.filter-dropdown.open .filter-panel {
  display: block;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* search inside panel */
.filter-search-wrap {
  padding: 10px 10px 6px;
  border-bottom: 1px solid var(--border);
}

.filter-search {
  width: 100%;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  padding: 7px 10px 7px 32px;
  border-radius: 8px;
  border: 1px solid var(--border-solid);
  background: var(--bg);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237a7568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}
.filter-search:focus { border-color: var(--green); }
.filter-search::placeholder { color: var(--muted); }

/* options list */
.filter-options {
  max-height: 240px;
  overflow-y: auto;
  padding: 6px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-solid) transparent;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-family: 'Noto Sans HK', sans-serif;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.1s;
}
.filter-option:hover { background: var(--bg); }
.filter-option.selected { color: var(--ink); font-weight: 500; }

/* custom checkbox */
.filter-option-check {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border-solid);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s;
  background: var(--surface);
}
.filter-option.selected .filter-option-check {
  background: var(--green);
  border-color: var(--green);
}
.filter-option-check-mark {
  display: none;
  width: 9px; height: 9px;
}
.filter-option.selected .filter-option-check-mark { display: block; }

.filter-option-text { flex: 1; }
.filter-option-badge {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  background: var(--bg-alt);
  padding: 1px 6px;
  border-radius: 8px;
}

/* panel footer */
.filter-panel-footer {
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.filter-clear-btn {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  letter-spacing: 0.04em;
  transition: color 0.15s;
}
.filter-clear-btn:hover { color: var(--ink); }

.filter-results-hint {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  text-align: right;
}

/* no results inside list */
.filter-no-results {
  padding: 20px 14px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

/* active filters summary strip */
.active-filters-strip {
  display: none;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.active-filters-strip.visible { display: flex; }

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 3px 10px 3px 10px;
  border-radius: 20px;
  background: var(--ink);
  color: #fff;
  letter-spacing: 0.03em;
}

.chip-remove {
  width: 14px; height: 14px;
  opacity: 0.6;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: opacity 0.12s;
  background: none; border: none; color: inherit;
  padding: 0; flex-shrink: 0;
}
.chip-remove:hover { opacity: 1; }

.clear-all-btn {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  background: none; border: none;
  cursor: pointer; padding: 3px 0;
  transition: color 0.15s;
  margin-left: 4px;
}
.clear-all-btn:hover { color: var(--ink); }

/* ── Main Grid ─────────────────────────────────────────── */
main {
  position: relative; z-index: 1;
  max-width: 1140px; margin: 0 auto;
  padding: 20px 24px 72px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 22px;
  align-items: start;
}

/* ── Card ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: fadeUp 0.4s ease both;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(0,0,0,0.11), 0 0 0 1px rgba(0,0,0,0.06);
}

.card-accent {
  height: 3px;
  background: linear-gradient(90deg, var(--green) 0%, #34d470 100%);
}

.card-body { padding: 20px 22px 22px; }

.card-meta {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 14px;
}

.branch-tag {
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 10px; border-radius: var(--radius-tag);
  background: var(--bg-alt); color: var(--muted);
}

.system-link {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--muted); text-decoration: none;
  display: flex; align-items: center; gap: 4px;
  transition: color 0.15s;
}
.system-link:hover { color: var(--green); }

.card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 21px; font-weight: 700; letter-spacing: -0.02em;
  margin-bottom: 16px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.card-title-zh {
  font-family: 'Noto Sans HK', sans-serif;
  font-size: 14px; font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}

/* ── Quick Links ───────────────────────────────────────── */
.links-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 20px;
}

.link-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 6px 13px; border-radius: 8px; text-decoration: none;
  transition: all 0.15s;
}
.link-btn:hover { filter: brightness(0.91); transform: translateY(-1px); }
.link-btn.home     { background: var(--blue-light);  color: var(--blue); }
.link-btn.dinein   { background: var(--green-light); color: var(--green); }
.link-btn.takeaway { background: var(--amber-light); color: var(--amber); }

/* ── Dine-In Table Section ─────────────────────────────── */
.dinein-section {
  background: var(--table-bg);
  border: 1px solid var(--table-border);
  border-radius: 12px;
  padding: 14px 16px 16px;
}

.dinein-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}

.dinein-icon {
  width: 26px; height: 26px;
  background: var(--green); border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.dinein-icon svg { width: 14px; height: 14px; fill: #fff; }

.dinein-title {
  font-family: 'Outfit', sans-serif;
  font-size: 13px; font-weight: 600;
  color: var(--table-text); letter-spacing: -0.01em;
}

.dinein-count {
  font-family: 'DM Mono', monospace;
  font-size: 10px; color: var(--green-mid);
  margin-left: auto;
  background: rgba(21,122,60,0.1);
  padding: 2px 8px; border-radius: 10px;
}

.tables-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
}

.table-btn {
  font-family: 'DM Mono', monospace;
  font-size: 12px; font-weight: 500;
  min-width: 38px; height: 38px;
  padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  border: 1px solid var(--table-border);
  background: #fff;
  color: var(--table-text);
  text-decoration: none;
  transition: all 0.14s;
  position: relative;
}
.table-btn::before {
  content: 'T';
  font-size: 7px;
  position: absolute; top: 4px; left: 5px;
  color: var(--green-mid); opacity: 0.6;
  font-family: 'DM Mono', monospace;
}
.table-btn:hover {
  background: var(--green);
  color: #fff; border-color: var(--green);
  transform: scale(1.08);
}
.table-btn:hover::before { color: rgba(255,255,255,0.7); }

.no-tables {
  font-size: 13px; color: var(--muted); font-style: italic;
  padding: 2px 0;
}

/* ── States ────────────────────────────────────────────── */
.loading-state, .empty-state {
  grid-column: 1 / -1;
  text-align: center; padding: 80px 24px;
  color: var(--muted);
  font-family: 'Outfit', sans-serif; font-size: 18px;
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 16px;
}

/* ── Animations ────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 600px) {
  header { padding: 32px 16px 20px; }
  main   { padding: 12px 16px 52px; grid-template-columns: 1fr; }
  .filter-panel { width: 260px; }
}
