/* FareScout — popup styles
 * Look chosen 2026-10-16: "sunset" header and result cards, boxed search form.
 * Palette: burgundy → raspberry gradients on warm off-white; dark theme
 * "midnight blue & gold".
 */

/* Commissioner (SIL Open Font License, assets/fonts/OFL.txt): bundled, so the
   extension needs no network for it and Greek looks the same everywhere. */
@font-face {
  font-family: "Commissioner";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../../assets/fonts/commissioner-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Commissioner";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../../assets/fonts/commissioner-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Commissioner";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../../assets/fonts/commissioner-greek.woff2") format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

:root {
  color-scheme: light;
  --bg: #fbf6f3;
  --card: #ffffff;
  --ink: #22131a;
  --muted: #76656c;
  --line: #f0e6e2; /* dividers */
  --line-strong: #e7d9d3; /* field and button borders */
  --soft: #f6eeeb; /* segmented track */
  --tint: #fcebf1; /* icon circles */
  --tint-ink: #8a1446;
  --price-bg: #fcebf1;
  --brand: #7d1240; /* solid fills: chips, toast */
  --accent: #7d1240; /* brand color for text, borders and focus rings */
  --on-fill: #ffffff;
  --fill: linear-gradient(135deg, #7d1240, #c2185b); /* primary buttons */
  --fill-shadow: 0 10px 22px -10px rgb(194 24 91 / 0.65);
  --hero: linear-gradient(135deg, #3f0315 0%, #74103b 55%, #b43b6b 100%);
  --fr: #073590;
  --fr-bg: #e8eefb;
  --w6: #c6007e;
  --w6-bg: #fce8f3;
  --new-bg: #fdf0d9;
  --new-ink: #8a5a12;
  --success: #1d5e3a;
  --success-bg: #e6f2ea;
  --danger: #a01c2c;
  --danger-bg: #fdecef;
  --placeholder: #9c8a91;
  --shadow-card: 0 1px 2px rgb(74 4 24 / 0.05), 0 12px 30px -16px rgb(74 4 24 / 0.3);
  --shadow-float: 0 20px 44px -18px rgb(74 4 24 / 0.45);

  --radius-lg: 20px;
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Commissioner", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Mask icons for elements whose text popup.js replaces (no room for an <svg> child). */
  --mask-globe: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18'/%3E%3C/svg%3E");
  --mask-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --mask-edit: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16z'/%3E%3Cpath d='m13.5 6.5 4 4'/%3E%3C/svg%3E");
}

/* Dark theme ("midnight blue & gold"). popup.js sets html[data-theme] from
   the saved choice or the system setting. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e131b;
  --card: #161e29;
  --ink: #e6ecf3;
  --muted: #98a5b4;
  --line: #222c3a;
  --line-strong: #2d3a4c;
  --soft: #1c2532;
  --tint: #252033;
  --tint-ink: #f0cf8f;
  --price-bg: #2a2418;
  --brand: #7a1631;
  --accent: #f0cf8f;
  --fill: linear-gradient(135deg, #7a1631, #a8285e);
  --fill-shadow: 0 10px 22px -12px rgb(0 0 0 / 0.7);
  --hero: linear-gradient(135deg, #111a27 0%, #2b1430 60%, #5a1a3e 100%);
  --fr: #a9c1ff;
  --fr-bg: #1b2742;
  --w6: #ff8fcf;
  --w6-bg: #3a1830;
  --new-bg: #2e2716;
  --new-ink: #f0cf8f;
  --success: #86d7a6;
  --success-bg: #12271e;
  --danger: #ff9c9c;
  --danger-bg: #34181c;
  --placeholder: #7d8a9a;
  --shadow-card: 0 1px 2px rgb(0 0 0 / 0.4), 0 12px 30px -16px rgb(0 0 0 / 0.6);
  --shadow-float: 0 20px 44px -18px rgb(0 0 0 / 0.7);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  width: 420px;
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font-family: inherit;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--muted);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Icons ---------- */

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  flex: none;
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-fill {
  fill: currentColor;
  stroke: none;
}

/* ---------- Layout ---------- */

/* The whole popup scrolls as one: the header scrolls away with the form,
   the results toolbar stays on top. */
.app {
  position: relative; /* contains absolutely positioned children (.sr-only), else they stretch the page */
  display: flex;
  flex-direction: column;
  max-height: 600px;
  overflow-y: auto;
}

.app-header {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 46px; /* the bottom is covered by the search card */
  overflow: hidden;
  background: var(--hero);
  color: #fff;
}

.app-header :focus-visible {
  outline-color: #fff;
}

.hero-trail {
  position: absolute;
  top: 32px;
  right: 8px;
  width: 230px;
  height: 96px;
  opacity: 0.45;
  pointer-events: none;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand > div {
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgb(255 255 255 / 0.28);
  border-radius: 50%;
  background: rgb(255 255 255 / 0.14);
  font-size: 18px;
}

.brand-mark .icon {
  transform: rotate(45deg);
}

/* Partner branding (html[data-brand]): its logo on a white badge, readable on
   the header in both themes. */
html[data-brand] .brand-mark {
  display: flex;
  align-items: center;
  width: auto;
  height: auto;
  padding: 3px 7px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.25);
}

html[data-brand] .brand-mark img {
  display: block;
  width: auto;
  height: 40px;
}

/* In the 600px extension popup the badge keeps the header at its usual height. */
html[data-brand]:not(.is-web) .brand-mark {
  padding: 2px 6px;
}

html[data-brand]:not(.is-web) .brand-mark img {
  height: 32px;
}

.brand-title {
  margin: 0;
  overflow: hidden;
  font: 800 19px/1.1 var(--font);
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-sub {
  margin: 2px 0 0;
  overflow: hidden;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap; /* one line: a wrap would push the 600px extension popup into scrolling */
  opacity: 0.8;
}

.header-actions {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.25);
  border-radius: 50%;
  background: rgb(255 255 255 / 0.12);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

.icon-btn:hover,
.icon-btn[aria-expanded="true"] {
  background: rgb(255 255 255 / 0.26);
}

.lang-select {
  position: relative;
  display: inline-flex;
}

.lang-select select {
  appearance: none;
  height: 32px;
  padding: 0 26px 0 11px;
  border: 1px solid rgb(255 255 255 / 0.25);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.12);
  color: #fff;
  font: 700 12px/1 var(--font);
  cursor: pointer;
}

.lang-select select:hover {
  background: rgb(255 255 255 / 0.26);
}

/* Some platforms draw the open list with the select's colors: keep it readable. */
.lang-select option {
  background: var(--card);
  color: var(--ink);
}

.lang-select::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 9px;
  width: 11px;
  height: 11px;
  background: #fff;
  -webkit-mask: var(--mask-chevron) center / contain no-repeat;
  mask: var(--mask-chevron) center / contain no-repeat;
  transform: translateY(-50%);
  pointer-events: none;
}

.app-main {
  position: relative; /* above the header, whose bottom the search card covers */
  z-index: 1;
  display: flex; /* column, so the footer can sit at the bottom when there is little content */
  flex-direction: column;
  flex: 1 0 auto;
  margin-top: -46px;
  padding: 12px;
}

/* ---------- Pills & badges ---------- */

.pill,
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.pill-warn {
  background: #fdf0d9;
  color: #6b4208;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.badges:empty {
  display: none;
}

.badge-new {
  background: var(--new-bg);
  color: var(--new-ink);
}

.badge-drop {
  background: var(--success-bg);
  color: var(--success);
}

/* ---------- Settings ---------- */

/* A card over the bottom of the header, like the search form below it. */
.settings {
  position: relative;
  z-index: 2;
  flex: none;
  margin: -34px 12px 0;
  padding: 14px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow-float);
}

.settings:not([hidden]) + .app-main {
  margin-top: 0;
}

.settings-body {
  display: grid;
  gap: 12px;
}

/* Agency settings (Regular surcharge, default search, luggage estimates, cache):
   only for partner accounts and the extension (html[data-brand]); everyone
   else sees theme and text size. */
html:not([data-brand]) .agency-only {
  display: none !important;
}

.settings .field input {
  width: 110px;
}

.defaults-summary {
  margin: 0;
  font-weight: 600;
}

.defaults-summary.is-empty {
  color: var(--muted);
  font-weight: 500;
}

.settings-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.settings-actions {
  margin-top: 10px;
}

.section-title {
  margin: 0 0 8px;
  font: 800 15px/1.2 var(--font);
  color: var(--ink);
}

/* ---------- Form ---------- */

.search {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.criteria {
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow-float);
}

/* Collapsed after a search: one line with the criteria, click to edit. */
.criteria-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  border-radius: 18px;
}

.criteria-summary::-webkit-details-marker {
  display: none;
}

.criteria-summary::before {
  content: "";
  flex: none;
  width: 15px;
  height: 15px;
  background: var(--tint-ink);
  -webkit-mask: var(--mask-edit) center / contain no-repeat;
  mask: var(--mask-edit) center / contain no-repeat;
}

.criteria[open] > .criteria-summary::before {
  -webkit-mask-image: var(--mask-chevron);
  mask-image: var(--mask-chevron);
  transform: rotate(180deg);
}

/* Nothing to collapse to before the first results: the form shows without its title row. */
.app-main:has(#results-toolbar[hidden]) .criteria[open] > .criteria-summary {
  display: none;
}

.criteria-title {
  font: 800 13.5px/1.2 var(--font);
  color: var(--ink);
  white-space: nowrap;
}

.criteria-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.criteria[open] .criteria-text {
  display: none;
}

.criteria-body {
  display: grid;
  gap: 9px;
  padding: 12px 14px;
}

.criteria[open] > .criteria-summary {
  padding-bottom: 0;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-group,
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

/* Rows may shrink to the field's width (a long quick-dates name is cut with …). */
.field-group > * {
  min-width: 0;
}

/* Lets a date range stack its two dates when the field is narrow (below). */
fieldset.field-group {
  container-type: inline-size;
}

.field-label {
  padding: 0;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
}

/* A field drawn as one rounded box: icon on the left, borderless inputs inside. */
.field-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--card);
  font-weight: 700;
}

.field-box:focus-within {
  border-color: var(--accent);
}

.field-box:has(input[aria-invalid="true"]) {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.field-icon {
  color: var(--tint-ink);
  font-size: 17px;
}

.field-box input[type] {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.field-box input[type]:focus-visible {
  outline: none; /* the box shows the focus */
}

.box-body {
  display: grid;
  flex: 1;
  min-width: 0;
}

.box-label {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.3;
}

/* Departure / return: two dates in one box. */
.range {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
}

.range input[type="date"] {
  position: relative;
  width: 100%;
  cursor: pointer;
}

/* Chrome: a click anywhere on the date opens the calendar, not only on its icon. */
.range input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

/* iPhone / iPad: date fields keep their own (too wide) size and center the
   date unless their native look is turned off. */
@supports (-webkit-touch-callout: none) {
  .range input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    min-width: 0;
    min-height: 1.5em;
  }

  .range input[type="date"]::-webkit-date-and-time-value {
    margin: 0;
    text-align: left;
  }
}

.range-sep {
  color: var(--muted);
  font-weight: 600;
}

/* Narrow field (phone with large text): "until" date on a second line. */
@container (max-width: 330px) {
  .range {
    grid-template-columns: auto minmax(0, 1fr);
    row-gap: 2px;
  }

  .range .range-sep {
    justify-self: center;
  }
}

/* Nights, travellers and budget, side by side. */
.row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.row-3 .field-box {
  gap: 7px;
  padding-inline: 10px;
}

.row-3 .field-icon {
  font-size: 15px;
}

/* One way: no return dates and no nights. */
.search.is-oneway .return-range,
.search.is-oneway .nights-box {
  display: none;
}

.search.is-oneway .row-3 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.search.is-oneway .return-label {
  color: var(--placeholder);
  text-decoration: line-through;
}

/* Narrow form (phones): nights and travellers on one line, budget below. */
.criteria-body {
  container-type: inline-size;
}

@container (max-width: 350px) {
  .row-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search:not(.is-oneway) .row-3 > :last-child {
    grid-column: 1 / -1;
  }
}

/* Travellers: a box that opens the people / bag panel below the row. */
.party-box {
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.party-box:hover,
.party-box[aria-expanded="true"] {
  border-color: var(--accent);
}

.party-box:focus-visible {
  outline-offset: 0;
}

.party-box[aria-invalid="true"] {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.party-value {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow: hidden;
  white-space: nowrap;
}

.party-value .icon {
  color: var(--muted);
  font-size: 13px;
}

.party-panel {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  background: var(--card);
}

.party-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  font-weight: 600;
}

.stepper {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
}

.step {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  font: 700 17px/1 var(--font);
  cursor: pointer;
}

.step:hover:not(:disabled) {
  border-color: var(--accent);
}

.step:disabled {
  opacity: 0.35;
  cursor: default;
}

.stepper output {
  min-width: 2ch;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.party-panel .field-hint {
  margin: 0;
}

.nights {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nights input[type] {
  width: 2.6ch;
  text-align: center;
}

.nights input[type]:first-of-type {
  text-align: left;
}

.field-box input[type="number"] {
  appearance: textfield;
}

.field-box input[type="number"]::-webkit-inner-spin-button,
.field-box input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#max-budget {
  width: 100%;
}

/* Header row of a field: label on the left, toggles on the right. */
.range-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
}

.presets {
  display: flex;
  gap: 6px;
  min-width: 0;
}

.airline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 800 11.5px/1 var(--font);
  white-space: nowrap;
  cursor: pointer;
}

.airline-toggle .icon {
  display: none;
}

.airline-toggle[aria-pressed="true"] {
  border-color: transparent;
}

.airline-toggle[aria-pressed="true"] .icon {
  display: block;
}

.airline-toggle[data-airline="FR"][aria-pressed="true"] {
  background: var(--fr-bg);
  color: var(--fr);
}

.airline-toggle[data-airline="W6"][aria-pressed="true"] {
  background: var(--w6-bg);
  color: var(--w6);
}

.preset-menu {
  position: relative;
  display: inline-flex;
  min-width: 0;
}

.preset-menu::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 9px;
  width: 11px;
  height: 11px;
  background: var(--ink);
  -webkit-mask: var(--mask-chevron) center / contain no-repeat;
  mask: var(--mask-chevron) center / contain no-repeat;
  transform: translateY(-50%);
  pointer-events: none;
}

.preset-menu select,
.preset-toggle {
  height: 28px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: 700 11.5px/1 var(--font);
  cursor: pointer;
}

.preset-menu select {
  appearance: none;
  field-sizing: content; /* as wide as the shown option, not the longest one (where supported) */
  min-width: 0; /* a long holiday name shrinks (…) instead of pushing the row off screen */
  max-width: 11.5rem;
  padding: 0 24px 0 11px;
  text-overflow: ellipsis;
}

.preset-menu option,
.preset-menu optgroup {
  background: var(--card);
  color: var(--ink);
}

.preset-toggle {
  padding: 0 11px;
  white-space: nowrap;
}

.preset-menu select:hover,
.preset-toggle:hover,
.airline-toggle:hover {
  border-color: var(--accent);
}

.preset-menu select.is-set,
.preset-toggle[aria-pressed="true"] {
  border-color: transparent;
  background: var(--fill);
  color: var(--on-fill);
}

.preset-menu:has(select.is-set)::after {
  background: var(--on-fill);
}

input[type="number"] {
  width: 100%;
  min-width: 0;
  padding: 7px 10px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

input[type="number"]:focus-visible {
  outline-offset: 0;
  border-color: var(--accent);
}

input[aria-invalid="true"] {
  border-color: var(--danger);
}

input::placeholder {
  color: var(--placeholder);
  font-weight: 600;
}

/* Segmented radios: origin (a track with a raised thumb) */

.segmented {
  display: flex;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--soft);
}

.segmented label {
  flex: 1;
  position: relative;
  min-width: 0;
}

.segmented input,
.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: block;
  padding: 7px 6px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.segmented label:hover span {
  color: var(--ink);
}

.segmented input:checked + span {
  background: var(--card);
  color: var(--accent);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.14);
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* …and sort (separate pills, the chosen one dark) */

.segmented-sm {
  gap: 6px;
  padding: 0;
  background: none;
}

.segmented-sm label {
  flex: none;
}

.segmented-sm span {
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  font-size: 12px;
}

.segmented-sm input:checked + span {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
  box-shadow: none;
}

/* Destinations: a box that opens into the country / city picker. */

.countries {
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--card);
}

.countries[open],
.countries:focus-within {
  border-color: var(--accent);
}

.countries-summary {
  position: relative;
  padding: 9px 36px 9px 39px;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius);
}

.countries-summary::-webkit-details-marker {
  display: none;
}

.countries-summary::before,
.countries-summary::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.countries-summary::before {
  left: 12px;
  width: 17px;
  height: 17px;
  background: var(--tint-ink);
  -webkit-mask: var(--mask-globe) center / contain no-repeat;
  mask: var(--mask-globe) center / contain no-repeat;
}

.countries-summary::after {
  right: 12px;
  width: 14px;
  height: 14px;
  background: var(--muted);
  -webkit-mask: var(--mask-chevron) center / contain no-repeat;
  mask: var(--mask-chevron) center / contain no-repeat;
}

.countries[open] .countries-summary::after {
  transform: translateY(-50%) rotate(180deg);
}

.countries-summary:focus-visible {
  outline-offset: -2px;
}

.countries-panel {
  max-height: 240px;
  padding: 8px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.chip {
  position: relative;
  display: inline-block;
}

.chip span {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.chip:hover span {
  border-color: var(--accent);
}

.chip input:checked + span {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--on-fill);
}

.chip input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chip-all span {
  font-weight: 700;
}

/* Destination search: stays at the top of the scrolling panel. */
.dest-search-bar {
  position: sticky;
  top: -8px;
  z-index: 1;
  margin: -8px -8px 8px;
  padding: 8px 8px 6px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

input[type="search"] {
  width: 100%;
  min-width: 0;
  padding: 6px 10px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}

input[type="search"]:focus-visible {
  outline-offset: 0;
  border-color: var(--accent);
}

.dest-no-match {
  margin: 8px 2px 2px;
  color: var(--muted);
  font-size: 12px;
}

/* Airport code after a city name. */
.chip-code {
  margin-left: 4px;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  opacity: 0.7;
}

/* Partly picked country (some of its cities). */
.chip input:indeterminate + span {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 14%, var(--card));
}

/* Destination picker: one row per country, its cities beside it. */
.dest-list {
  display: grid;
  margin-top: 6px;
}

.dest-row {
  display: grid;
  grid-template-columns: minmax(0, 8.75rem) minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  padding: 5px 0;
  border-top: 1px solid var(--line);
}

.dest-row > .chip {
  max-width: 100%;
}

.dest-row > .chip span {
  max-width: 100%;
  font-weight: 700;
}

.dest-cities {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip-city span {
  padding: 2px 8px;
  font-size: 11.5px;
}

.dest-other {
  padding-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.form-error {
  margin: 0;
  padding: 9px 12px;
  border-left: 3px solid var(--danger);
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 700;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font: 700 13px/1.2 var(--font);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  border: 0;
  background: var(--fill);
  color: var(--on-fill);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-ghost {
  border-color: var(--line-strong);
  background: var(--card);
  color: var(--ink);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--accent);
}

.btn-link {
  padding: 4px 6px;
  border: 0;
  background: none;
  color: var(--muted);
}

.btn-link:hover {
  color: var(--accent);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-link.btn-sm {
  padding: 4px 5px;
}

/* Square icon-only button (copy for Sheets / Canva on a card). */
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-color: var(--line-strong);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Search, with ↺ (back to my default search) beside it */
.search-row {
  display: flex;
  gap: 8px;
}

.reset-btn {
  display: grid;
  flex: none;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  background: var(--card);
  color: var(--tint-ink);
  font-size: 19px;
  cursor: pointer;
}

.reset-btn:hover {
  border-color: var(--accent);
}

.btn-block {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  box-shadow: var(--fill-shadow);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.search-icon {
  font-size: 17px;
}

.btn-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgb(255 255 255 / 0.35);
  border-top-color: var(--on-fill);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.is-busy .btn-spinner {
  display: inline-block;
}

.is-busy .search-icon {
  display: none;
}

/* ---------- Results ---------- */

.results {
  margin-top: 16px;
}

.results-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 8px;
  margin: 0 -12px 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.results-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-heading {
  flex: 1;
  min-width: 0;
}

.results-meta .section-title {
  margin: 0;
  font-size: 17px;
}

.results-meta .muted {
  display: block;
  font-size: 12px;
}

.results-meta .btn-link {
  font-weight: 700;
}

.results-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.bulk-actions {
  display: flex;
  gap: 6px;
}

.notice {
  margin-bottom: 10px;
  padding: 9px 12px;
  border-left: 3px solid var(--tint-ink);
  border-radius: 10px;
  background: var(--tint);
  font-size: 12px;
}

.notice p {
  margin: 0;
}

.notice p + p {
  margin-top: 4px;
}

.status:empty {
  display: none;
}

/* The extension popup has no room for the "set your criteria" hint. */
html:not(.is-web) .status-idle {
  display: none;
}

.status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--muted);
  text-align: center;
}

.status-error {
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger);
}

.status-title {
  margin: 0;
  color: var(--ink);
  font: 800 14px/1.3 var(--font);
}

.status-error .status-title {
  color: var(--danger);
}

.status p {
  margin: 0;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--tint);
  border-top-color: var(--tint-ink);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.results-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Result card: a colored stripe on the left for the airline. */
.card {
  --air: var(--fr);
  padding: 14px 14px 12px 18px;
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: inset 5px 0 0 var(--air), var(--shadow-card);
}

.card[data-airline="W6"] {
  --air: var(--w6);
}

.card article {
  display: grid;
  gap: 11px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

/* Country flag (emoji), or the country code where the system has no flag emoji. */
.flag {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg);
  font-size: 22px;
  line-height: 1;
}

.flag:empty {
  display: none;
}

.flag.is-code {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.route {
  flex: 1;
  min-width: 0;
}

.route-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
}

.route-cities {
  margin: 0;
  font: 800 16.5px/1.2 var(--font);
  letter-spacing: -0.01em;
}

.route-country {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.route-meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
}

.route-airline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--air);
  font-weight: 700;
}

.route-airline::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.price-block {
  display: grid;
  flex: none;
  justify-items: end;
  align-content: start;
  padding: 6px 10px;
  border-radius: 14px;
  background: var(--price-bg);
  text-align: right;
}

.price-label {
  order: 1;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.price {
  color: var(--accent);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.price-regular {
  order: 2;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.legs {
  display: grid;
  gap: 5px;
}

.leg {
  display: grid;
  grid-template-columns: 24px auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.leg-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--card);
  color: var(--tint-ink);
  font-size: 13px;
}

.leg-time {
  font-weight: 500;
}

.leg-flight,
.leg-price {
  color: var(--muted);
  font-weight: 500;
}

.leg-price {
  text-align: right;
}

.next-day {
  margin-left: 2px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  vertical-align: super;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.card-copy {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
}

.alt {
  padding-top: 8px;
  border-top: 1px dashed var(--line-strong);
}

.alt-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.alt-status:empty {
  display: none;
}

.alt-status.is-error {
  color: var(--danger);
}

.alt-status .spinner {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

.alt-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.alt-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.alt-row:nth-child(odd) {
  background: var(--bg);
}

.alt-row.is-cheapest .alt-price {
  color: var(--success);
  font-weight: 800;
}

.alt-nights {
  color: var(--muted);
}

.alt-price {
  font-weight: 700;
}

.alt-book {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.alt-book:hover {
  text-decoration: underline;
}

.alt-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  margin-top: 4px;
  font-size: 12px;
}

.disclaimer {
  margin: 8px 4px 4px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.app-footer {
  margin-top: auto;
  padding-top: 6px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-align: center;
}

.app-footer strong {
  color: var(--accent);
  font-weight: 800;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 10;
  max-width: 360px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--on-fill);
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgb(74 4 24 / 0.35);
  transform: translateX(-50%);
  animation: toast-in 0.18s ease-out;
}

.toast.is-error {
  background: var(--danger);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1.5s !important;
    transition: none !important;
  }

  .toast {
    animation: none;
  }
}

/* ---------- Text size (Settings) ---------- */
/* The whole page is scaled; the extension popup still stays 600px tall on screen. */

html[data-size="large"] {
  --zoom: 1.12;
}

html[data-size="xlarge"] {
  --zoom: 1.25;
}

html[data-size] body {
  zoom: var(--zoom);
}

html[data-size] .app {
  max-height: calc(600px / var(--zoom));
}

html.is-web[data-size] .app {
  max-height: none;
  min-height: calc(100dvh / var(--zoom));
}

/* Phones with large text: the header keeps the name (or the partner's logo)
   and drops the other mark, so it fits beside the buttons. */
@media (max-width: 440px) {
  html.is-web[data-size]:not([data-brand]) .brand-mark,
  html.is-web[data-size][data-brand] .brand > div {
    display: none;
  }
}

/* ---------- Web version (opened from a URL, e.g. on a phone) ---------- */
/* popup.js adds .is-web when not running inside the extension. */

html.is-web body {
  width: auto;
}

/* The page itself scrolls (so phones can hide their address bar). */
html.is-web .app {
  max-width: 560px;
  min-height: 100vh;
  min-height: 100dvh;
  max-height: none;
  margin: 0 auto;
  overflow: visible;
}

html.is-web .app-header {
  padding-top: 14px;
  padding-bottom: 50px;
}

html.is-web .app-main {
  margin-top: -50px;
  padding: 14px;
}

html.is-web .results-toolbar {
  margin-inline: -14px;
  padding-inline: 14px;
}

@media (min-width: 600px) {
  html.is-web .app {
    box-shadow: 0 0 0 1px var(--line), 0 30px 60px -30px rgb(74 4 24 / 0.25);
  }
}

/* iOS zooms into fields smaller than 16px on focus. */
@media (pointer: coarse) {
  html.is-web input[type="date"],
  html.is-web input[type="search"],
  html.is-web input[type="number"] {
    font-size: 16px;
  }
}

/* Phones: no header subtitle (it would wrap next to the language and theme
   controls); each leg on two lines when the times do not fit. */
@media (max-width: 440px) {
  html.is-web .brand-sub {
    display: none;
  }

  html.is-web .dest-row {
    grid-template-columns: minmax(0, 7rem) minmax(0, 1fr);
  }

  /* Quick dates get their own line, so the picked preset is not cut short. */
  html.is-web .date-presets {
    flex: 1 1 100%;
  }

  html.is-web .preset-menu {
    flex: 1;
  }

  html.is-web .preset-menu select {
    width: 100%;
    max-width: none;
  }

  html.is-web .leg {
    grid-template-columns: 24px auto minmax(0, 1fr) auto;
    grid-template-areas:
      "icon date time   price"
      "icon .    flight .";
    row-gap: 0;
  }

  html.is-web .leg-icon { grid-area: icon; }
  html.is-web .leg-date { grid-area: date; }
  html.is-web .leg-time { grid-area: time; }
  html.is-web .leg-flight { grid-area: flight; font-size: 11px; }
  html.is-web .leg-price { grid-area: price; }

  html.is-web .leg-flight:empty {
    display: none;
  }
}

/* Phones and touch screens (web version only): finger-sized tap targets,
   about 40px tall instead of the 26–32px that suit a mouse in the popup. */
@media (pointer: coarse), (max-width: 440px) {
  html.is-web .icon-btn {
    width: 40px;
    height: 40px;
    font-size: 17px;
  }

  html.is-web .lang-select select {
    height: 40px;
    padding: 0 28px 0 14px;
    font-size: 14px;
  }

  html.is-web .airline-toggle,
  html.is-web .preset-toggle,
  html.is-web .preset-menu select {
    height: 36px;
    font-size: 13px;
  }

  html.is-web .airline-toggle,
  html.is-web .preset-toggle {
    padding: 0 14px;
  }

  html.is-web .segmented span {
    padding: 11px 8px;
  }

  html.is-web .segmented-sm span {
    padding: 9px 14px;
  }

  html.is-web .field-box {
    min-height: 46px;
  }

  html.is-web .countries-summary {
    padding-block: 12px;
  }

  html.is-web input[type="search"],
  html.is-web input[type="number"]:not(.field-box *) {
    min-height: 40px;
  }

  html.is-web input[type="search"],
  html.is-web input[type="date"],
  html.is-web input[type="number"] {
    font-size: 16px; /* also stops iOS from zooming in on focus */
  }

  html.is-web .chip span {
    padding: 8px 12px;
    font-size: 13px;
  }

  html.is-web .chip-city span {
    padding: 7px 11px;
    font-size: 12.5px;
  }

  html.is-web .dest-cities,
  html.is-web .chip-grid {
    gap: 6px;
  }

  html.is-web .btn-sm {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 13px;
  }

  html.is-web .btn-icon {
    width: 40px;
    height: 40px;
  }

  html.is-web .btn-link.btn-sm {
    padding: 8px 8px;
  }

  html.is-web .alt-row {
    min-height: 40px;
    font-size: 13px;
  }

  html.is-web .alt-book {
    padding: 8px 4px;
  }
}
