/* The side panel: header, language switch, search box, category tiles and filters. */

.panel {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  min-height: 0;
  z-index: 1;
}

/* Header */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 24px 18px;
}
.logo {
  width: 48px; height: 48px;
  flex: none;
  display: grid; place-items: center;
  font-size: 26px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 18%, var(--panel));
  transition: background .25s;
}
.brand-text { min-width: 0; flex: 1; }
.brand h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.location {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Language menu: a small "🌐 EN ▾" button over the browser's own language list */
.lang-picker {
  position: relative;
  flex: none;
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
}
.lang-picker select {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 16px; /* 16px stops iPhones zooming in */
}
.lang-caret { font-size: 10px; color: var(--muted); }
.lang-picker:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 24px 18px;
  border-bottom: 1px solid var(--border);
}

/* Search box */
.search-wrap { position: relative; }
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid transparent;
  transition: border-color .15s, background .15s;
}
.search:focus-within { border-color: var(--accent); background: var(--panel); }
.search-icon { font-size: 14px; opacity: .7; }
.search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.search input::placeholder { color: var(--muted); }
.clear-query {
  flex: none;
  width: 26px; height: 26px;
  border: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  display: grid; place-items: center;
}

/* Suggestions dropdown */
.suggest {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 6px);
  left: 0; right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 340px;
  overflow-y: auto;
}
.suggest li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.suggest li[aria-selected="true"] { background: var(--surface); }
.suggest li:active { background: var(--surface-2); }
.s-icon {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--cat) 16%, var(--panel));
  font-size: 18px;
}
.s-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.s-text b, .s-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-text b { font-size: 14px; font-weight: 600; }
.s-text small { font-size: 12px; color: var(--muted); }

/* What the search understood */
.understood { margin-top: -6px; align-items: center; }
.understood-label {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); background: none !important; padding-left: 0 !important;
}

/* Category tiles */
.cats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 12px 2px 10px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  transition: transform .12s, border-color .15s, background .15s;
}
.cat:active { transform: scale(.96); }
.cat .emoji { font-size: 24px; line-height: 1.1; }
.cat .label {
  max-width: 100%;
  font-size: 12px; font-weight: 600; letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cat .label.long { font-size: 10.5px; letter-spacing: -0.02em; }
.cat .count {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-height: 14px;
}
.cat[aria-selected="true"] {
  border-color: var(--cat);
  background: color-mix(in srgb, var(--cat) 14%, var(--panel));
}
.cat[aria-selected="true"] .label,
.cat[aria-selected="true"] .count { color: var(--cat); }

/* Filters */
.filter-block { display: flex; flex-direction: column; gap: 7px; }
.filter-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.filter-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }

/* Open-now switch */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.track {
  width: 40px; height: 24px;
  flex: none;
  border-radius: 999px;
  background: var(--surface-2);
  position: relative;
  transition: background .2s;
}
.thumb-dot {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .2s;
}
.switch input:checked + .track { background: var(--open); }
.switch input:checked + .track .thumb-dot { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 760px) {
  .brand { padding: 14px 16px 12px; }
  .controls { padding: 0 16px 14px; gap: 12px; }
  .cats { gap: 6px; }
  .cat { padding: 11px 0 9px; }
  .cat .label { font-size: 11px; }
  .cat .label.long { font-size: 9.5px; letter-spacing: -0.03em; }
}
