:root {
  --bg: #0b0c10;
  --panel: #11131a;
  --card: #151823;
  --text: #e7e9ef;
  --muted: #a5adbd;
  --accent: #66e0a3;
  --accent2: #4db6ff;
  --border: #23283a;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: Inter, system-ui, Segoe UI, Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, #0a0c12, #0f1320 60%, #0a0c12);
  color: var(--text);
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 4vw, 2rem);
  background: rgba(10, 12, 18, 0.7);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.logo {
  font-size: 1.4rem;
}
.brand h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
}

.topbar-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

/* Search bar */
.search-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #11131a;
  border: 1px solid var(--border);
  border-radius: 2rem;
  padding: 0.25rem 0.5rem;
  max-width: 1200px;
  width: min(75vw, 900px);
}
.search-row input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 0.6rem 1rem;
  color: var(--text);
  font-size: 1rem;
}
.icon-btn {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 50%;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Controls row */
.control-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.select-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #0e1322;
  border: 1px solid var(--border);
  padding: 0.25rem 0.5rem;
  border-radius: 0.6rem;
}
.select-wrap .lbl {
  color: var(--muted);
  font-size: 0.85rem;
}
.select-wrap select {
  background: transparent;
  color: var(--text);
  border: none;
  outline: none;
  padding: 0.25rem 0.3rem;
}

.filter-wrap {
  position: relative;
}
.btn.outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}
.btn.solid {
  background: linear-gradient(180deg, #1a2334, #121827);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
}

.filter-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #0e1322;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.4rem 0.6rem;
  display: grid;
  gap: 0.3rem;
  z-index: 40;
  transition: opacity 0.15s ease, transform 0.15s ease;
  transform-origin: top right;
}
.filter-menu label {
  white-space: nowrap;
  font-size: 0.92rem;
}
.filter-menu[hidden] {
  display: block !important;
  opacity: 0;
  transform: scaleY(0.96);
  height: 0;
  overflow: hidden;
}

/* Autocomplete */
.ac {
  position: relative;
  flex: 1;
}
.ac-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #0f1422;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  list-style: none;
  margin: 0;
  padding: 0.25rem;
  max-height: 260px;
  overflow: auto;
  z-index: 50;
}
.ac-list li {
  padding: 0.45rem 0.6rem;
  border-radius: 0.5rem;
  cursor: pointer;
}
.ac-list li[aria-selected="true"],
.ac-list li:hover {
  background: #162037;
}

/* make the input fill the whole search row (minus the icon button) */
.search-row .ac {
  position: relative;
  flex: 1 1 auto;   /* <-- grow to take remaining space */
  min-width: 0;     /* <-- allow input to expand properly inside flex */
}

.search-row .ac input#dish {
  width: 100%;      /* <-- fill .ac fully */
  display: block;
}

/* (optional) tame the default search styling on Safari/Chrome */
.search-row input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
}

/* Content */
.content-only {
  padding: 1rem clamp(1rem, 4vw, 2rem);
  display: grid;
  gap: 0.75rem;
}
.muted {
  color: var(--muted);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card-image {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
}
.card-image .img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(1.05);
}
.card-image .fav {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border);
  color: #ffe082;
  padding: 0.25rem 0.5rem;
  border-radius: 0.75rem;
}
.card-body {
  padding: 0.9rem;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.title {
  margin: 0.2rem 0;
  font-size: 1.05rem;
}
.badge {
  font-size: 0.8rem;
  color: #111;
  /* background: linear-gradient(135deg, var(--accent), var(--accent2)); */
  padding: 0.15rem 0.5rem;
  border-radius: 0.5rem;
}
.addr {
  color: var(--muted);
  margin: 0.25rem 0 0.5rem;
}
.pill-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.pill {
  font-size: 0.75rem;
  color: #b9c7dd;
  background: #0e1421;
  border: 1px dashed #23304a;
  padding: 0.15rem 0.45rem;
  border-radius: 0.5rem;
}
.btn-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.btn {
  background: linear-gradient(180deg, #1a2334, #121827);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.55rem 0.8rem;
  border-radius: 0.7rem;
  cursor: pointer;
}
.btn.outline {
  background: transparent;
}
.icon-btn.solid {
  background: #0f1422;
  color: #fff;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

/* Footer */
.footer {
  display: flex;
  justify-content: center;
  padding: 1rem;
  border-top: 1px solid var(--border);
  background: #0a0d17;
  position: sticky;
  bottom: 0;
  z-index: 20;
}

/* Dialog */
.dialog { border: none; padding: 0; background: transparent; z-index: 200; }
.dialog::backdrop { background: rgba(0,0,0,.6); }

.dialog-wrap {
  width: min(900px, 96vw);
  max-height: 86vh;
  overflow: auto;
  background: #0b0f19;
  border: 1px solid var(--border);
  border-radius: 1rem;
  color: var(--text);            /* <- ensure text is visible */
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.dialog-body {
  color: var(--text);            /* <- force text color inside body */
  padding: 1rem;
  display: grid;
  gap: .9rem;
}

.dialog-body h4, .dialog-body h5 { margin: .2rem 0; }
.recipe-head {
  display: grid;
  gap: 0.25rem;
}
.recipe-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.chip {
  font-size: 0.8rem;
  background: #0e1522;
  border: 1px solid #24314a;
  padding: 0.2rem 0.5rem;
  border-radius: 0.5rem;
}

@media (max-width: 980px) {
  .topbar-controls {
    width: 100%;
    align-items: stretch;
  }
  .search-row {
    width: 100%;
  }
  .control-row {
    justify-content: space-between;
  }
}
