/* Framework-free styling for the winter-sport comparison app. */

:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #17202e;
  --muted: #64748b;
  --line: #dde3ec;
  --accent: #0f5ea8;
  --accent-soft: #e8f1fb;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --good: #166534;
  --good-soft: #e9f6ec;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .35em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

.topbar {
  background: linear-gradient(120deg, #0b3f70, #0f5ea8);
  color: #fff;
  padding: 1.1rem 1rem;
}
.topbar-inner { max-width: 1200px; margin: 0 auto; }
.subtitle { margin: 0; opacity: .9; font-size: .92rem; }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .9rem 1rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: .9rem 1.2rem;
  align-items: flex-end;
}
.control { display: flex; flex-direction: column; gap: .25rem; min-width: 0; max-width: 100%; }
.control label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.control.checkbox { flex-direction: row; align-items: center; gap: .45rem; }
.control.checkbox label { text-transform: none; letter-spacing: 0; font-size: .9rem; color: var(--ink); }

select, input[type="search"], input[type="number"], textarea {
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .45rem .55rem;
  min-width: 8rem;
  /* long option labels must not push the control past the viewport */
  max-width: 100%;
  width: 100%;
}
input[type="number"] { min-width: 5rem; }
textarea { width: 100%; min-height: 4.5rem; resize: vertical; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: .45rem .8rem;
}
button.ghost { background: #fff; color: var(--accent); }
button.link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  text-decoration: underline;
  font-size: .85rem;
}
button:hover { filter: brightness(1.06); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.1rem;
  font-size: .88rem;
  color: var(--ink);
}
.legend .muted { color: var(--muted); }

.status { color: var(--muted); font-size: .9rem; padding: 0 .2rem; }
.status.error { color: #b91c1c; }

.listings { display: flex; flex-direction: column; gap: 1rem; }

.listing {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.listing-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem .5rem;
  flex-wrap: wrap;
}
.listing-name { margin: 0 0 .15rem; }
.listing-place { margin: 0; color: var(--muted); font-size: .9rem; }
.listing-usps { margin: .35rem 0 0; font-size: .85rem; color: var(--accent); }
.listing-price { text-align: right; min-width: 10rem; }
.price-value { font-size: 1.45rem; font-weight: 700; }
.price-total { color: var(--muted); font-size: .85rem; }
.price-discount { color: var(--good); font-size: .82rem; }

.gallery { padding: 0 1rem; }
.gallery-stage {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #eef2f7;
}
.gallery-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gallery-image { display: block; width: 100%; height: 460px; object-fit: cover; }

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(15, 32, 56, .55);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-nav:hover { background: rgba(15, 32, 56, .8); filter: none; }
.gallery-nav.prev { left: .7rem; }
.gallery-nav.next { right: .7rem; }

.gallery-counter {
  position: absolute;
  right: .7rem;
  bottom: .7rem;
  padding: .1rem .5rem;
  border-radius: 999px;
  background: rgba(15, 32, 56, .6);
  color: #fff;
  font-size: .78rem;
}

body.lightbox-open { overflow: hidden; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2.5rem 1rem;
  background: rgba(8, 15, 26, .92);
}
.lightbox[hidden] { display: none; }
.lightbox-image {
  max-width: min(1500px, 92vw);
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  background: #0b1220;
}
.lightbox-nav,
.lightbox-close {
  position: absolute;
  border: none;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  font-size: 1.7rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-nav:hover,
.lightbox-close:hover { background: rgba(255, 255, 255, .3); filter: none; }
.lightbox-nav.prev { left: 1.2rem; top: 50%; transform: translateY(-50%); }
.lightbox-nav.next { right: 1.2rem; top: 50%; transform: translateY(-50%); }
.lightbox-close { top: 1rem; right: 1rem; font-size: 1.9rem; }
.lightbox-caption {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: .8rem;
  align-items: baseline;
  color: #fff;
  font-size: .9rem;
}
.lightbox-counter { opacity: .75; }

.gallery-thumbs { display: flex; gap: .4rem; overflow-x: auto; padding: .5rem 0; }
.gallery-thumbs img {
  width: 84px; height: 60px; object-fit: cover;
  border-radius: 6px; border: 2px solid transparent; cursor: pointer;
}
.gallery-thumbs img.active { border-color: var(--accent); }

.listing-body { padding: .5rem 1rem 0; }
.listing-description { margin: 0 0 .6rem; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: .3rem .9rem;
  margin: 0 0 .6rem;
  font-size: .88rem;
}
.facts div { display: flex; gap: .35rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

.options { padding: .4rem 1rem 1rem; }
.options-title { margin: .3rem 0 .5rem; color: var(--muted); font-weight: 600; font-size: .9rem; }
.options-scroll { overflow-x: auto; }

table.options-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  min-width: 820px;
}
.options-table th, .options-table td {
  text-align: left;
  padding: .45rem .5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.options-table th {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  white-space: nowrap;
}
.options-table tbody tr:hover { background: #f8fafc; }
.option-name-text { display: block; }
td.num, th.num { text-align: right; }

.badge {
  display: inline-block;
  padding: .05rem .4rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
}
.badge.ok { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.muted { background: #eef2f7; color: var(--muted); }

.details-row td { background: #f8fafc; }
.room-list { margin: 0; padding-left: 1.1rem; }
.room-list li { margin-bottom: .15rem; }
.room-list .room-beds { color: var(--muted); }

.note-row td { background: var(--accent-soft); }
.note-editor { display: flex; flex-direction: column; gap: .5rem; }
.note-actions { display: flex; gap: .5rem; align-items: center; }
.note-saved { color: var(--good); font-size: .82rem; }

.sunweb-link { display: inline-block; margin-top: .35rem; font-size: .85rem; }
.option-link a { white-space: nowrap; }

.note-cell-text {
  display: block;
  max-width: 16rem;
  white-space: pre-wrap;
  color: var(--ink);
}
.note-cell-text.empty { color: var(--muted); font-style: italic; }

.notes-panel h2 { margin-bottom: .5rem; }
.notes-overview { display: flex; flex-direction: column; gap: .5rem; }
.note-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .55rem .7rem;
  background: #fbfcfe;
}
.note-card .note-where { font-size: .8rem; color: var(--muted); }
.note-card .note-text { white-space: pre-wrap; margin: .2rem 0 0; }
.notes-empty { color: var(--muted); font-size: .9rem; }

@media (max-width: 640px) {
  .controls { flex-direction: column; align-items: stretch; }
  .control.checkbox { flex-direction: row; }
  .listing-price { text-align: left; }
  .gallery-image { height: 300px; }
  .gallery-nav { width: 2.2rem; height: 2.2rem; font-size: 1.3rem; }
  .lightbox { padding: 3.5rem .5rem; gap: .25rem; }
  .lightbox-image { max-width: 96vw; max-height: 78vh; }
  .lightbox-nav { width: 2.4rem; height: 2.4rem; font-size: 1.4rem; }
  .lightbox-nav.prev { left: .4rem; }
  .lightbox-nav.next { right: .4rem; }
  .facts { grid-template-columns: 1fr; }
  main { padding: .6rem; }
}
