:root {
  --accent: #4fc3b1;
  --accent-dark: #2f9c8c;
  --bg: #f5f6f8;
  --card-bg: #ffffff;
  --text: #202124;
  --muted: #6b7280;
  --border: #e3e5e8;
  --late: #e8622c;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--text);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 20px; margin: 0; }
.topbar-brand { display: flex; align-items: baseline; gap: 10px; }
.topbar-brand .tagline { font-size: 13px; color: rgba(255,255,255,0.72); font-style: italic; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-home { color: inherit; text-decoration: none; }
.topbar-link { color: #fff; text-decoration: none; font-size: 14px; font-weight: 600; opacity: 0.9; }
.topbar-link:hover { opacity: 1; text-decoration: underline; }

/* About page: a single readable column of prose. */
.about {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  line-height: 1.55;
}
.about h2 { font-size: 22px; margin: 0 0 12px; }
.about h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }
.about-section { margin-top: 28px; }
.about-section ul { margin: 0; padding-left: 20px; }
.about-section li { margin-bottom: 4px; }
.about a { color: var(--accent-dark); }
.about-tmdb {
  border-top: 1px solid var(--border);
  padding-top: 24px;
}
.about-tmdb .tmdb-logo { width: 180px; max-width: 60%; height: auto; display: block; margin-bottom: 12px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }
.btn-secondary { background: #eef2f2; color: var(--text); }
.btn-secondary:hover { background: #e2e8e8; }
.btn-block { width: 100%; margin-bottom: 6px; }

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  padding: 20px;
  align-items: start;
}

.filters {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  position: sticky;
  top: 70px;
}

.filter-group { margin-bottom: 18px; }
.filter-group h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }
.filter-group select, .filter-group input[type="text"] {
  width: 100%;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 14px;
}
.stacked-label { display: block; font-size: 12px; margin-bottom: 4px; color: var(--muted); }

/* Location / Τ.Κ. sort status. Empty = hidden; otherwise a coloured pill so
   the active distance-sort (and any error) is obvious at a glance. */
.geo-status { margin-top: 8px; font-size: 12px; }
.geo-status:empty { display: none; }
.geo-status--active,
.geo-status--error,
.geo-status--loading {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 600;
  line-height: 1.3;
}
.geo-status--active { background: var(--accent); color: #fff; }
.geo-status--loading { background: #eef2f2; color: var(--muted); font-weight: 500; }
.geo-status--error { background: #fdecec; color: #c0392b; }

.tk-row { display: flex; gap: 6px; margin-top: 6px; }
.tk-row input {
  flex: 1;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 14px;
}
.tk-row .btn { padding: 7px 10px; white-space: nowrap; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.checkbox-list { max-height: 132px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.checkbox-list label { font-size: 13px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.checkbox-list .count { color: var(--muted); font-size: 11px; }

.results { min-height: 60vh; }
#resultsMeta { margin-bottom: 10px; }

.movie-grid {
  display: grid;
  /* min(340px, 100%) keeps a single column from overflowing on phones
     narrower than 340px instead of forcing a horizontal scrollbar. */
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 16px;
}

.movie-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  gap: 12px;
}
.movie-card .poster {
  width: 92px;
  height: 130px;
  object-fit: cover;
  border-radius: 8px;
  background: #ddd;
  flex-shrink: 0;
}
.movie-body { flex: 1; min-width: 0; }
.movie-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.movie-title { font-size: 16px; font-weight: 700; margin: 0; }
.movie-title .title-link { color: inherit; text-decoration: none; }
.movie-title .title-link:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.movie-original-title { font-size: 12px; color: var(--muted); margin: 0 0 4px; }
.movie-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.tag { background: #eef2f2; border-radius: 10px; padding: 2px 8px; font-size: 11px; color: var(--muted); }
.tag-age { background: #f0e6f4; color: #6a3d82; font-weight: 700; cursor: help; }

.ratings-row { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; margin-bottom: 8px; }
.rating-badge { display: flex; align-items: center; gap: 3px; white-space: nowrap; }
.rating-badge b { font-size: 13px; }

.trailer-link { font-size: 12px; font-weight: 600; color: var(--accent-dark); text-decoration: none; white-space: nowrap; }
.trailer-link:hover { text-decoration: underline; }

/* Static row of outbound source links (Athinorama, LiFO, IMDb, Rotten
   Tomatoes), always rendered in the same order; absent sources are omitted. */
.source-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.source-links-label { font-size: 11px; color: var(--muted); }
.source-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-dark);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px 8px;
  background: #fff;
}
.source-link:hover { background: #eef2f2; }

.cinema-block { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 8px; }
.cinema-name-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; font-weight: 600; }
.cinema-meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; }

.time-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.time-chip {
  background: #eef2f2;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.time-chip .icon { margin-right: 3px; }

/* Start-time colour bands: light yellow (matinee) -> dark purple (late
   night). Kept in sync with timeBandClass() in app.js. */
.time-band-1 { background: #fdf3b0; color: #6b5900; } /* before 15:00 */
.time-band-2 { background: #ffd571; color: #6b4a00; } /* 15:00-16:59 */
.time-band-3 { background: #ff9f5a; color: #5c2900; } /* 17:00-18:59 */
.time-band-4 { background: #e56f96; color: #fff; }    /* 19:00-20:59 */
.time-band-5 { background: #9a54b0; color: #fff; }    /* 21:00-22:59 */
.time-band-6 { background: #4b2483; color: #fff; }    /* 23:00 and later */

.time-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.time-legend .legend-label { font-size: 12px; color: var(--muted); }
.time-legend .time-chip { cursor: default; }

/* Sort control lives at the far right of the legend row. */
.sort-control {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sort-control label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sort-control select {
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: inherit;
}

/* Headline ("1st") combined rating badge, drawn as a five-star bar. */
.rating-combined {
  gap: 5px;
  cursor: help;
}
.rating-combined small { font-size: 12px; font-weight: 700; color: var(--muted); }

.stars {
  position: relative;
  display: inline-block;
  font-size: 15px;
  line-height: 1;
  color: #d9dee0; /* empty star colour */
}
.stars::before {
  content: "★★★★★";
  letter-spacing: 1px;
}
.stars-fill {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  white-space: nowrap;
  color: #f5b301; /* filled star colour */
}
.stars-fill::before {
  content: "★★★★★";
  letter-spacing: 1px;
}

/* Ratings rendered as outbound links (IMDb, Rotten Tomatoes). */
.rating-link { text-decoration: none; color: inherit; cursor: pointer; }
.rating-link:hover { text-decoration: underline; }
.rating-badge[data-tippy-content] { cursor: help; }

.more-cinemas-btn {
  margin-top: 10px;
  width: 100%;
  border: 1px dashed var(--border);
  background: #fafbfb;
  color: var(--accent-dark);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.more-cinemas-btn:hover { background: #eef2f2; }

.empty-state { text-align: center; color: var(--muted); padding: 60px 0; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 24, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal {
  position: relative;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px 20px 20px;
  max-width: 480px;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: #eef2f2;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
}
.modal-close:hover { background: #e2e8e8; }
.modal-title { font-size: 16px; font-weight: 700; margin: 0 0 12px; padding-right: 24px; }
.modal .cinema-block:first-child { margin-top: 0; border-top: none; padding-top: 0; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; gap: 14px; padding: 14px; }
  .filters { position: static; }
}

/* Phone layout: tighten spacing, let the legend/sort wrap cleanly, and keep
   posters and touch targets sensible on narrow screens. */
@media (max-width: 520px) {
  .topbar { padding: 12px 14px; }
  .topbar h1 { font-size: 17px; }
  .topbar-brand .tagline { display: none; }
  .topbar-actions { font-size: 12px; }

  .layout { padding: 10px; gap: 12px; }
  .movie-grid { gap: 12px; }
  .movie-card { padding: 12px; gap: 10px; }
  .movie-card .poster { width: 72px; height: 104px; }
  .movie-title { font-size: 15px; }

  /* Move the sort control onto its own full-width line under the legend. */
  .sort-control { margin-left: 0; flex-basis: 100%; }

  /* Comfortable tap targets for the filter controls. */
  .chip { padding: 8px 14px; }
  .checkbox-list label { padding: 2px 0; }

  .modal { padding: 20px 14px 14px; max-height: 88vh; }
}
