:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-soft: #eff4ff;
  --good: #059669;
  --sea: #0891b2;
  --weekend: #7c3aed;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px -16px rgba(15, 23, 42, 0.25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1rem; }

/* Topbar */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.65rem; }
.logo {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--brand); color: #fff;
  border-radius: 11px; font-size: 1.1rem;
}
.brand strong { display: block; font-size: 1.05rem; }
.brand .sub { font-size: 0.8rem; color: var(--muted); }
.status { font-size: 0.82rem; color: var(--muted); text-align: right; line-height: 1.5; }
.status b { color: var(--ink); }
.rate { display: block; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.5rem 0 1rem; }
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { color: var(--ink); border-color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Filters */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}
.f { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.f-wide { grid-column: span 2; }
.f label {
  font-size: 0.72rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.filters input,
.filters select {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font-size: 0.92rem;
  color: var(--ink);
  outline: none;
  width: 100%;
  font-family: inherit;
}
.filters input:focus, .filters select:focus { border-color: var(--brand); }
.check {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.9rem; color: var(--ink);
  border: 1px solid var(--line); background: var(--card);
  border-radius: 10px; padding: 0.55rem 0.7rem; cursor: pointer; white-space: nowrap;
}
.check input { accent-color: var(--brand); width: auto; }

/* Bar */
.bar {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 0.9rem; font-size: 0.88rem; color: var(--muted);
}
.bar #count { font-weight: 600; color: var(--ink); }

/* Nézetváltó (segmented) */
.view-toggle {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.view-toggle button {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.view-toggle button:hover { color: var(--ink); }
.view-toggle button.active { background: var(--brand); color: #fff; }

/* Dátum-szekció fejléc (csoportos nézet) */
.daygroup { margin-bottom: 1.6rem; }
.dayhead {
  display: flex; align-items: baseline; gap: 0.6rem;
  margin: 0 0 0.7rem; padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--line);
}
.dayhead .d { font-size: 1.05rem; font-weight: 700; }
.dayhead .wd { font-size: 0.85rem; color: var(--brand); font-weight: 600; text-transform: capitalize; }
.dayhead .n { margin-left: auto; font-size: 0.8rem; color: var(--muted); }

/* Grid + cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.9rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -16px rgba(15,23,42,0.35); }
.card .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.card .city { font-size: 1.15rem; font-weight: 700; }
.card .country { font-size: 0.8rem; color: var(--muted); margin-top: 0.1rem; }
.card .price { font-size: 1.4rem; font-weight: 800; color: var(--brand); white-space: nowrap; }
.card .price small { display: block; font-size: 0.62rem; font-weight: 600; color: var(--muted); }

.legs { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.86rem; }
.leg { display: flex; gap: 0.5rem; align-items: center; }
.leg b { font-weight: 600; }
.leg .time { color: var(--muted); }
.leg.alt { color: var(--weekend); }
.leg.alt .time { color: var(--weekend); opacity: 0.85; }

.badges { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.badge {
  font-size: 0.72rem; font-weight: 600;
  padding: 0.15rem 0.55rem; border-radius: 999px;
  border: 1px solid var(--line);
}
.badge.cheap { color: var(--good); background: #ecfdf5; border-color: #a7f3d0; }
.badge.sea { color: var(--sea); background: #ecfeff; border-color: #a5f3fc; }
.badge.weekend { color: var(--weekend); background: #f5f3ff; border-color: #ddd6fe; }

.book {
  margin-top: auto;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.6rem;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  transition: background 0.15s;
}
.book:hover { background: #dbeafe; }

/* States */
.state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; margin: 0 auto 1rem; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.foot { padding: 2.5rem 1rem; text-align: center; color: var(--muted); font-size: 0.82rem; }
.foot a { color: var(--brand); text-decoration: none; }

@media (max-width: 620px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .filters input[type="search"] { grid-column: 1 / -1; }
  .status { text-align: left; }
}
