/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --color-primary: #1a56db;
  --color-primary-hover: #1240a8;
  --color-bg: #ffffff;
  --color-surface: #f5f5f5;
  --color-border: #e0e0e0;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --gap-xs: 8px;
  --gap-md: 16px;
  --gap-lg: 24px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

/* ── Global layout ─────────────────────────────────────────── */
body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  padding-bottom: 48px;
}

main {
  min-height: 100vh;
  padding-bottom: var(--gap-lg);
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

/* ── Language switcher ─────────────────────────────────────── */
.language-switcher {
  position: fixed;
  bottom: var(--gap-md);
  right: var(--gap-md);
  z-index: 100;
}


/* ── Locale picker backdrop ──────────────────────────────── */
.locale-picker-backdrop {
  display: none;
  position: fixed;
  z-index: 199;
  background: rgba(0, 0, 0, 0);
}
.language-switcher .globe-icon-link {
  position: relative;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: background 150ms ease, transform 150ms ease;
  touch-action: none; /* don't let the browser fight JS gesture handling */
  -webkit-tap-highlight-color: transparent;
}

.language-switcher .globe-icon-link:active {
  transform: scale(0.95);
}

.globe-icon {
  width: 24px;
  height: 24px;
}

/* ── Locale picker ─────────────────────────────────────────── */
.language-switcher .locale-picker {
  display: none;
  position: absolute;
  bottom: calc(100% + var(--gap-xs));
  right: 0;
  width: 240px;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
  padding: var(--gap-xs) 0;
  z-index: 200;
}

.language-switcher .locale-picker-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  overflow-y: auto;           /* scroll when content exceeds available height */
  overscroll-behavior: contain;
}

.language-switcher .locale-option {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 10px 16px;
  border: none;
  background: none;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: background 100ms ease;
}

.language-switcher .locale-option:hover,
.language-switcher .locale-option:active {
  background: var(--color-surface);
}

.language-switcher .locale-option[aria-current="true"] {
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-surface);
}

/* ── Splash page ───────────────────────────────────────────── */
.splash {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.splash__hero {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.splash__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.splash__content {
  width: 100%;
  padding: var(--gap-lg) var(--gap-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--gap-md);
  flex: 1;
}

.splash__title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
}

.splash__subtitle {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  max-width: 320px;
  margin: 0;
}

.splash__cta {
  margin-top: var(--gap-xs);
}

.splash__locations-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin: var(--gap-md) 0 0 0;
}

/* ── Browse (category grid) ─────────────────────────────────── */
.browse {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 48px);
  padding: var(--gap-lg) var(--gap-md);
  max-width: 600px;
  margin: 0 auto;
}

.browse__title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 var(--gap-lg) 0;
}

.browse__subtitle {
  color: var(--color-text);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 var(--gap-md) 0;
}

.browse__empty {
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--gap-lg) 0;
}

.back-link {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--gap-md);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
  background: transparent;
  min-height: 48px;
  padding: 12px var(--gap-lg);
  text-align: center;
  width: 100%;
  transition: background 150ms ease, color 150ms ease;
  cursor: pointer;
}

.back-link:hover {
  background: var(--color-primary) !important;
  color: #fff;
  border-color: var(--color-primary);
}

/* Top margin when the back link sits after a venue list — separates it from card rows */
.browse .back-link,
.venue-list + .back-link {
  margin-top: var(--gap-md);
}

/* ── Spacing before back button on long pages ─────────────── */
.back-spacer {
  height: calc(var(--gap-lg) + clamp(60px, 10vh, 120px));
}

/* Large touch-friendly back button at bottom of browse pages */
.back-link-button {
  display: block;
  width: 100%;
  padding: 16px var(--gap-lg);
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  color: var(--color-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-top: var(--gap-md);
  min-height: 48px;
}

.back-link-button:active {
  background: var(--color-border);
}

/* Full-width touch-friendly back link on vendor detail pages */
.back-link--full-width {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px var(--gap-lg);
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
}

/* ── Category grid ─────────────────────────────────────────── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap-md);
}

/* ── Location grid (home page) ─────────────────────────────── */
.location-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap-md);
  width: 100%;
}

.location-card {
  min-width: 0;
  width: 100%;
  padding: calc(var(--gap-lg) * 1.5) var(--gap-lg);
}

.location-card .category-card__icon {
  font-size: 2.75rem;
}

.location-card .category-card__label {
  font-size: 1.15rem;
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--gap-lg) var(--gap-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  text-align: center;
  transition: box-shadow 150ms ease, transform 150ms ease;
}

.category-card:active {
  transform: scale(0.97);
}

.category-card__icon {
  font-size: 2rem;
  margin-bottom: var(--gap-xs);
}

.category-card__label {
  font-weight: 600;
  font-size: 1rem;
}

/* ── Subcategory grid ──────────────────────────────────────── */
.subcategory-grid {
  display: flex;
  flex-direction: column;
  gap: var(--gap-xs);
}

.subcategory-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--gap-md) var(--gap-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  transition: background 150ms ease;
}

.subcategory-card:active {
  background: var(--color-border);
}

.subcategory-card__label {
  font-weight: 500;
}

.subcategory-card__count {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

/* ── Venue list ────────────────────────────────────────────── */
.venue-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap-xs);
}

.venue-card {
  display: block;
  padding: var(--gap-md) var(--gap-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.venue-card__name {
  font-weight: 600;
  display: block;
}

.venue-card__address {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* ── Location page category headings ─────────────────────────── */
.location-category__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: var(--gap-lg) 0 var(--gap-xs) 0;
}

.location-category:first-child .location-category__title {
  margin-top: 0;
}

/* ── Location page group headings ──────────────────────────── */
.location-group__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: var(--gap-lg) 0 var(--gap-xs) 0;
}

/* ── Vendor detail page ────────────────────────────────────── */
.vendor-detail {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--gap-lg) var(--gap-md);
}

.vendor-detail__header {
  margin-bottom: var(--gap-md);
}

.vendor-detail__name {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
}

.vendor-detail__body {
  color: var(--color-text-muted);
  margin-bottom: var(--gap-md);
}

.vendor-detail__info {
  border-top: 1px solid var(--color-border);
  padding-top: var(--gap-md);
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
  margin-bottom: var(--gap-lg);
}

.vendor-detail__row {
  display: flex;
  justify-content: space-between;
  gap: var(--gap-md);
}

.vendor-detail__row dt {
  font-weight: 600;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.vendor-detail__row dd a {
  word-break: break-all;
}

/* ── Buttons ───────────────────────────────────────────────── */
.button {
  display: inline-block;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}

.button--primary {
  background: var(--color-primary);
  color: #fff;
}

.button--primary:hover {
  background: var(--color-primary-hover);
}

.button--secondary {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.button--small {
  padding: 4px 12px;
  font-size: 0.8rem;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
}

/* ── Registration form page ─────────────────────────────────── */
.form-page {
  max-width: 520px;
  margin: 0 auto;
  padding: var(--gap-lg) var(--gap-md);
}

.form-page h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 var(--gap-xs) 0;
}

.form-page__subtitle {
  color: var(--color-text-muted);
  margin: 0 0 var(--gap-lg) 0;
}

/* ── Required-field hint (always visible) ───────────────── */
.form-required-hint {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: var(--gap-md);
}

.form-required-hint .required-dot {
  color: #dc2626;
  font-weight: 700;
}

/* ── Required asterisk on labels ─────────────────────────── */
.required-label {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.required-star {
  color: #dc2626;
  font-weight: 700;
  margin-left: 0;
}

.form {
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
}

.form__label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.form__input,
.form__select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: #fff;
}

.form__input:focus,
.form__select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(26, 86, 219, 0.15);
}

.form__submit {
  margin-top: var(--gap-xs);
}

.form__errors {
  padding: var(--gap-md);
  border-radius: var(--radius-sm);
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.9rem;
  font-weight: 500;
}

.form__errors ul {
  margin: 0;
  padding-left: var(--gap-md);
}

/* ── Inline field error messages (below each input) ──────── */
.field-error {
  display: block;
  min-height: 1.2em;
  color: #dc2626;
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 2px;
}

/* ── Admin page ────────────────────────────────────────────── */
.admin-page {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--gap-lg) var(--gap-md);
}

.admin-page h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 var(--gap-lg) 0;
}

.admin-page__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-md);
  margin-bottom: var(--gap-lg);
}

.notice {
  padding: var(--gap-md);
  border-radius: var(--radius-sm);
  background: #ecfdf5;
  color: #065f46;
  margin-bottom: var(--gap-md);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: var(--gap-xs) var(--gap-md);
  border-bottom: 1px solid var(--color-border);
}

.admin-table thead th {
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-table__name {
  font-weight: 500;
}

.admin-table__select {
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.admin-table__textarea {
  width: 100%;
  min-width: 160px;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

.toggle {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}

.admin-desc-editor {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 2px;
}

.admin-desc-lang {
  width: auto;
  min-width: 100px;
  flex-shrink: 0;
}

.toggle--on {
  background: #d1fae5;
  color: #065f46;
}

.toggle--off {
  background: #fee2e2;
  color: #991b1b;
}

/* hidden checkbox that triggers the toggle form */
.toggle-link {
  cursor: pointer;
  text-decoration: none;
}
.toggle-link:hover span {
  filter: brightness(0.95);
}


/* ── Responsive (tablet +) ─────────────────────────────────── */
@media (min-width: 600px) {
  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
