/* ==========================================================================
   Abu Dhabi Foodie Map — styles
   ========================================================================== */
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f4efe6;
  --ink: #1f2a2e;
  --muted: #6b7770;
  --primary: #0d6e5f;
  --primary-dark: #0a5849;
  --accent: #c9a227;
  --accent-soft: #f6edcf;
  --line: #e8e1d6;
  --danger: #b4531f;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 6px 22px rgba(20, 40, 35, .08);
  --shadow-hover: 0 12px 30px rgba(20, 40, 35, .14);
  --maxw: 1200px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei",
               "Noto Sans Arabic", "Noto Kufi Arabic", Tahoma, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 14px rgba(10, 60, 50, .25);
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-emoji { font-size: 32px; line-height: 1; }
.brand h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: .2px; }
.tagline { margin: 2px 0 0; font-size: 12.5px; opacity: .85; max-width: 46ch; }

.header-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.city-tabs { display: flex; gap: 4px; background: rgba(255,255,255,.14); border-radius: 999px; padding: 3px; }
.city-tabs button {
  border: 0; background: transparent; color: #fff; cursor: pointer;
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  position: relative; opacity: .85;
}
.city-tabs button.active { background: #fff; color: var(--primary-dark); opacity: 1; }
.city-tabs button[disabled] { cursor: not-allowed; opacity: .6; }
.city-tabs .soon {
  font-size: 9px; background: var(--accent); color: #3a2e00; border-radius: 6px;
  padding: 1px 5px; margin-inline-start: 5px; vertical-align: middle; font-weight: 700;
}

.lang-switch { display: flex; gap: 3px; background: rgba(255,255,255,.14); border-radius: 999px; padding: 3px; }
.lang-switch button {
  border: 0; background: transparent; color: #fff; cursor: pointer;
  width: 34px; height: 30px; border-radius: 999px; font-size: 13px; font-weight: 700; opacity: .8;
}
.lang-switch button.active { background: #fff; color: var(--primary-dark); opacity: 1; }

/* ---------- Layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 18px; }

/* ---------- Search ---------- */
.search-bar { display: flex; gap: 10px; margin: 6px 0 16px; }
#searchInput {
  flex: 1;
  padding: 14px 18px;
  font-size: 15px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  outline: none;
}
#searchInput:focus { border-color: var(--primary); }
#surpriseBtn {
  border: 0; background: var(--accent); color: #3a2e00; font-weight: 700;
  padding: 0 18px; border-radius: 999px; cursor: pointer; font-size: 14px;
  white-space: nowrap; box-shadow: var(--shadow);
}
#surpriseBtn:hover { filter: brightness(1.04); }

/* ---------- Header credit + slim data note ---------- */
.brand-credit { margin: 5px 0 0; font-size: 14px; font-weight: 700; color: #ecdca0; letter-spacing: .3px; }
.data-note { margin: 6px 2px 8px; font-size: 12px; color: var(--muted); line-height: 1.45; }

/* ---------- Category tabs ---------- */
.category-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 2px 14px; }
.cat-tab {
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 9px 18px; font-size: 14px; font-weight: 700;
  cursor: pointer; box-shadow: var(--shadow); transition: all .12s ease;
}
.cat-tab:hover { border-color: var(--primary); }
.cat-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Filters ---------- */
.filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.filter-group h3 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  font-weight: 700;
}
.chips { display: flex; flex-wrap: wrap; gap: 7px; max-height: 150px; overflow-y: auto; }
.chips::-webkit-scrollbar { width: 6px; }
.chips::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.chip {
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .12s ease;
  user-select: none;
}
.chip:hover { border-color: var(--primary); }
.chip .count { font-size: 11px; color: var(--muted); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.active .count { color: rgba(255,255,255,.8); }
.chip.tier.active { background: var(--accent); border-color: var(--accent); color: #3a2e00; }
.chip.tier.active .count { color: rgba(58,46,0,.7); }
.chip.deal.active { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 4px 2px 16px;
}
.results-count { font-size: 14px; font-weight: 700; color: var(--primary-dark); }
.toolbar-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-controls label { font-size: 12px; color: var(--muted); font-weight: 600; }
.toolbar-controls select {
  border: 1.5px solid var(--line); border-radius: 999px; padding: 7px 12px;
  background: var(--surface); color: var(--ink); font-size: 13px; cursor: pointer;
}
#clearBtn {
  border: 1.5px solid var(--line); background: var(--surface); color: var(--danger);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer; font-weight: 600;
}
#clearBtn:hover { border-color: var(--danger); }

/* ---------- Groups & Cards ---------- */
.group { margin-bottom: 26px; }
.group-head {
  display: flex; align-items: baseline; gap: 10px; margin: 0 2px 12px;
  padding-bottom: 8px; border-bottom: 2px solid var(--line);
}
.group-head .g-symbol {
  font-size: 18px; font-weight: 800; color: var(--accent);
}
.group-head .g-title { font-size: 17px; font-weight: 800; margin: 0; }
.group-head .g-count { font-size: 13px; color: var(--muted); }
.group-hint { font-size: 12px; color: var(--muted); margin: -6px 2px 12px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-name { font-size: 16.5px; font-weight: 700; margin: 0; line-height: 1.25; }
.card-sub { font-size: 12px; color: var(--muted); margin: 3px 0 0; }

.rating {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 3px;
  background: var(--accent-soft); color: #6b5600; font-weight: 800;
  border-radius: 999px; padding: 4px 9px; font-size: 13px;
}
.rating.na { background: var(--surface-2); color: var(--muted); font-weight: 600; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: 11.5px; border-radius: 999px; padding: 3px 9px;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  display: inline-flex; align-items: center; gap: 4px;
}
.badge.cuisine { background: #eaf4f1; color: var(--primary-dark); border-color: #d3e8e2; font-weight: 600; }
.badge.tier { background: var(--accent-soft); color: #6b5600; border-color: #ecdca0; font-weight: 700; }
.badge.deal { background: #fbeee6; color: var(--danger); border-color: #f2d8c8; font-weight: 600; }

.dishes { font-size: 12.5px; color: var(--muted); }
.dishes b { color: var(--ink); font-weight: 600; }

.card-note { font-size: 13px; color: var(--ink); opacity: .85; }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.price-tag { font-size: 13px; color: var(--muted); font-weight: 600; }
.price-tag .sym { color: var(--accent); font-weight: 800; }
.maps-link {
  text-decoration: none; font-size: 12.5px; font-weight: 700;
  color: var(--primary); border: 1.5px solid var(--primary); border-radius: 999px;
  padding: 6px 12px; white-space: nowrap; transition: all .12s ease;
}
.maps-link:hover { background: var(--primary); color: #fff; }

.empty {
  text-align: center; padding: 60px 20px; color: var(--muted); font-size: 15px;
}
.empty-fallback {
  margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-fallback p { margin: 0; color: var(--ink); font-weight: 600; }
.empty-fallback .maps-link { font-size: 14px; padding: 9px 18px; }
.missing-add-form {
  width: min(100%, 620px);
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  text-align: left;
}
[dir="rtl"] .missing-add-form { text-align: right; }
.missing-add-form h3 { margin: 0 0 4px; font-size: 16px; color: var(--primary-dark); }
.missing-add-form p { margin: 0 0 12px; color: var(--muted); font-size: 13px; font-weight: 500; }
.missing-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 10px;
}
.missing-fields label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.missing-fields input,
.missing-fields select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
}
.missing-fields input:focus,
.missing-fields select:focus { border-color: var(--primary); }
#addMissingBtn {
  margin-top: 12px;
  border: 0;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
#addMissingBtn:hover { filter: brightness(1.05); }
#addMissingBtn:disabled { cursor: wait; opacity: .68; filter: none; }
.missing-add-form .missing-error {
  margin-top: 9px;
  color: var(--danger);
  font-weight: 700;
}

/* ---------- Footer ---------- */
footer {
  max-width: var(--maxw); margin: 20px auto 40px; padding: 20px 18px 0;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px;
}
footer p { margin: 6px 0; }

/* ---------- RTL ---------- */
[dir="rtl"] .tagline { margin-left: auto; }
[dir="rtl"] .group-head { text-align: right; }

/* ---------- Responsive ---------- */
@media (min-width: 720px) {
  .filters { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1020px) {
  .filters { grid-template-columns: 2fr 2fr 1.1fr 1.4fr; }
}
@media (max-width: 560px) {
  .brand h1 { font-size: 17px; }
  .tagline { display: none; }
  .header-inner { padding: 12px 14px; }
  main { padding: 14px; }
  .grid { grid-template-columns: 1fr; }
  .missing-fields { grid-template-columns: 1fr; }
}
