/* events.css — Events tab (Flow B) chrome, on the Clarity token system.
   Loaded only by index_events.html (behind HOME_EVENTS_ENABLED), so none of
   this reaches the production home. Ported from the design canvas
   design_handoff_events_flow_b/source/airhint-events.css (Flow B subset);
   tokens (--primary, --surface, --text-hi, ...) come from main.css. */

/* ---- tab visibility ---- */
#events-form { display: none; }
.events-tab-active #search-form { display: none; }
.events-tab-active #events-form { display: block; }

/* Honour the hidden attribute on elements whose base rule sets a display
   (a class selector would otherwise beat the UA [hidden]{display:none}). */
.ahe-input[hidden], .ahe-selected[hidden], .ahe-own[hidden], .ahe-hint[hidden], .ahe-bar[hidden] { display: none; }

/* The events "Flying from" reuses the flight form's airport select2. The flight
   form hides the native <select> via `#airports select` (main.css); our field is
   not in #airports, so replicate it here — otherwise the bare native select
   shows as an empty box stacked under the select2 widget. */
#events-origin-container { position: relative; }
#events-origin-container select { height: 28px; position: absolute; }
#events-origin-container .airport-field,
#events-origin-container .select2-container { width: 100% !important; max-width: none !important; }

/* ---- Flights | Events segmented toggle ---- */
.ahe-toggle {
  display: flex; gap: 4px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 4px; margin-bottom: 16px;
}
.ahe-seg {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: none; background: none; border-radius: 6px; padding: 10px 12px;
  min-height: 44px; font-family: var(--font-body); font-weight: 700;
  font-size: 15px; color: var(--text-mid); cursor: pointer;
  transition: background .15s, color .15s;
}
.ahe-seg:hover { background: var(--surface-alt); }
.ahe-seg.is-on { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-btn); }
.ahe-seg.is-on:hover { background: var(--primary-hover); }
.ahe-seg svg { flex: 0 0 auto; }

/* ---- event field ---- */
.ahe-eventfield { position: relative; margin-bottom: 12px; }
.ahe-input {
  display: flex; align-items: center; gap: 11px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0 14px; min-height: 50px; font-size: 15.5px; color: var(--text-hi);
  cursor: text;
}
.ahe-input.is-focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.ahe-input-ic { color: var(--text-lo); display: inline-flex; flex: 0 0 auto; }
.ahe-input input {
  flex: 1 1 auto; min-width: 0; border: none; outline: none; background: none;
  font-family: var(--font-body); font-size: 15.5px; color: var(--text-hi);
  padding: 14px 0; height: 100%;
}
.ahe-input input::placeholder { color: var(--text-lo); }

/* live results dropdown */
.ahe-drop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-pop);
  overflow-x: hidden; overflow-y: auto; max-height: min(66vh, 560px);
}
.ahe-drop[hidden] { display: none; }
.ahe-evrow {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  min-height: 64px; cursor: pointer; border-top: 1px solid var(--border);
  width: 100%; text-align: left; background: none; border-left: none;
  border-right: none; border-bottom: none;
}
.ahe-evrow:first-child { border-top: none; }
.ahe-evrow:hover, .ahe-evrow.is-hover { background: var(--surface-alt); }
.ahe-evtxt { min-width: 0; flex: 1 1 auto; }
.ahe-evname { font-family: var(--font-display); font-weight: 700; font-size: 15.5px; color: var(--text-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ahe-evloc { font-size: 13.5px; color: var(--text-mid); margin-top: 2px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ahe-evloc b { color: var(--text-hi); font-weight: 700; }
.ahe-evdate { font-size: 12.5px; color: var(--text-lo); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ahe-empty { padding: 20px 16px; text-align: center; font-size: 14.5px; color: var(--text-mid); }
/* artist rows (top of the list) + the divider before the show rows */
.ahe-evrow.is-artist { min-height: 56px; }
.ahe-evrow.is-artist .ahe-evname { font-weight: 800; }
.ahe-drop-sep { height: 1px; background: var(--border-strong); margin: 0; }
.ahe-drop-sep + .ahe-evrow { border-top: none; }

/* event thumbnail — gradient placeholder standing in for real event imagery */
.ahe-thumb {
  border-radius: 9px; flex: 0 0 auto; display: grid; place-items: center;
  color: #fff; font-family: var(--font-display); font-weight: 800;
  text-shadow: 0 1px 2px rgba(0,0,0,.25); overflow: hidden;
  width: 44px; height: 44px; font-size: 15px;
}
.ahe-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* selected-show summary card */
.ahe-selected {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 8px 10px 10px; min-height: 60px; cursor: pointer;
}
.ahe-selected:hover { border-color: var(--primary); }
.ahe-selected .ahe-thumb { width: 56px; height: 56px; font-size: 19px; border-radius: 12px; }
.ahe-evmeta { font-size: 13.5px; color: var(--text-mid); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ahe-evwhen {
  display: inline-block; font-family: var(--font-display); font-size: 12.5px;
  font-weight: 700; color: var(--rec-text); background: var(--rec-bg);
  border-radius: 999px; padding: 3px 10px; margin-top: 5px;
}
.ahe-sel-x {
  width: 38px; height: 38px; margin-left: auto; border: none; background: none;
  border-radius: var(--radius-sm); color: var(--text-mid); font-size: 21px;
  line-height: 1; cursor: pointer; display: grid; place-items: center; flex: 0 0 auto;
}
.ahe-sel-x:hover { background: var(--surface-alt); }

/* collapse chevron in the events form header (shown only when the form was
   opened in place over the windows / results by tapping the event bar) */
/* .toggle-button (main.css) is position:absolute; anchor it inside this box,
   at the header's right edge, or it floats off to the page corner. */
.ahe-collapse { position: relative; margin-left: auto; flex: 0 0 auto; width: 40px; min-height: 28px; }
#events-collapse-btn { display: flex; }
#events-collapse-btn[hidden] { display: none; }

/* "Show me when to fly" — left-aligned primary, not full width */
.ahe-submit { display: inline-flex; align-items: center; justify-content: center; }
#events-form .input-group { display: block; }

/* On a from-event results page the rich event bar replaces the plain route summary. */
.events-results-active #collapsed-search-panel { display: none !important; }
/* "← Back to travel windows" under that bar */
.ahe-backlink-wrap { text-align: left; margin: -6px auto 12px; }
.ahe-backlink-wrap[hidden] { display: none; }
.ahe-backlink { font-size: 13.5px; font-weight: 600; color: var(--link, #2563EB); text-decoration: none; }
.ahe-backlink:hover { text-decoration: underline; }

/* While the When-to-fly screen — or the events form reached back from it — is
   up after a from-event flight search, the previous flight stays out of view:
   route summary, skeleton, prediction card and result listings. Cleared when
   the flights context returns (Flights tab / a new flight search). */
.events-windows-active #collapsed-search-panel,
.events-windows-active #skeleton_screen,
.events-windows-active #price_container,
.events-windows-active #main_alert,
.events-windows-active #no_flight,
.events-windows-active #stay22_no_results_banner,
.events-windows-active #destination_activity_panel,
.events-windows-active #hints_list2_panel,
.events-windows-active #alternative_message,
.events-windows-active #carhire_container,
.events-windows-active #inline_ad_0,
.events-windows-active #alternative_flights,
.events-windows-active #all_flights,
.events-windows-active #alternatives_show_more { display: none !important; }

/* ---- Travel windows screen ---- */
#events-windows-screen { margin-top: 4px; }
#events-windows-screen[hidden] { display: none; }

/* rich event-anchored bar */
.ahe-bar {
  display: flex; flex-direction: row; align-items: center; gap: 13px;
  width: 100%; text-align: left; background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; margin-bottom: 14px;
}
.ahe-bar:hover { border-color: var(--border-strong); }
/* The results-page event bar carries both .ahe-bar (width:100%) and
   .central-content (width:500px; margin:0 auto); .ahe-bar wins the cascade, so
   the bar ran full-width and left-aligned. Re-assert the centered width (ID
   beats class) so it matches the normal collapsed-search summary. */
#events-results-bar { max-width: 500px; margin-left: auto; margin-right: auto; }
.ahe-bar .ahe-thumb { width: 46px; height: 46px; font-size: 16px; border-radius: 11px; }
.ahe-bar-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.ahe-bar-title { font-family: var(--font-display); font-weight: 800; font-size: 17px; color: var(--text-hi); }
.ahe-bar-title em { font-style: normal; font-weight: 600; color: var(--text-mid); }
.ahe-when-meta { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; }
.ahe-when-row { display: flex; flex-wrap: wrap; gap: 3px 14px; }
.ahe-when-fact { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--text-mid); }
.ahe-when-fact svg { flex: none; opacity: .65; }
.ahe-bar-trip { font-size: 13px; color: var(--text-mid); margin-top: 2px; }
.ahe-bar-chev { color: var(--text-lo); display: inline-flex; align-self: center; flex: 0 0 auto; }

.ahe-when-title { font-family: var(--font-display); font-weight: 800; font-size: 21px; color: var(--text-hi); letter-spacing: var(--display-letter); margin: 8px 0 12px; }

/* window cards */
.ahe-win {
  display: flex; flex-direction: column; align-items: stretch; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-btn);
  padding: 14px 16px; cursor: pointer; margin-bottom: 12px; width: 100%;
  text-align: left;
}
.ahe-win:hover { border-color: var(--border-strong); }
/* head row: day tag + nights pill left, price + chevron top-right */
.ahe-win-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; }
.ahe-win-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.ahe-daytag { display: inline-block; font-size: 12.5px; font-weight: 700; color: var(--rec-text); background: var(--rec-bg); border-radius: 999px; padding: 4px 11px; }
/* dates wrap between items only — each date and the nights pill stay whole */
.ahe-win-dates { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-family: var(--font-display); font-weight: 700; font-size: 16.5px; color: var(--text-hi); }
.ahe-win-date { white-space: nowrap; }
.ahe-arrow { color: var(--text-lo); }
.ahe-nights { font-size: 12.5px; font-weight: 700; color: var(--text-mid); background: var(--surface-alt); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.ahe-win-sub { font-size: 13.5px; color: var(--text-mid); line-height: 1.4; }
/* arrival airport line — pin + "Stansted (STN)" */
.ahe-win-dest { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; font-weight: 600; color: var(--text-mid); }
.ahe-win-dest svg { flex: none; opacity: .65; }
.ahe-win-buy { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-left: auto; flex: 0 0 auto; }
/* "Best price": pinned to the right end of the dates line (margin-left:auto), so it
   reads under the price while reusing a row every card has — the best card keeps the
   same height as the others. */
.ahe-best { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--green); background: color-mix(in srgb, var(--green) 13%, var(--surface)); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.ahe-win-price { font-family: var(--font-display); font-weight: 800; font-size: 20px; color: var(--text-hi); white-space: nowrap; }
.ahe-win-chev { color: var(--text-lo); display: inline-flex; }
.ahe-hint { font-size: 13.5px; color: var(--text-lo); line-height: 1.5; padding: 2px; }
/* the hint as a subtitle directly under "When to fly": pull up to the title,
   align its left edge with it, and keep a clear gap before the cards */
.ahe-when-sub { margin: -6px 0 14px; padding: 0; }

/* loading state — the window query takes ~30s. Quip + note under the title,
   placeholder cards (shimmer from main.css .skeleton) where the windows go. */
.ahe-loading { margin: 0 0 14px; }
.ahe-loading[hidden] { display: none; }
.ahe-loading .ah-quip { justify-content: flex-start; text-align: left; }
.ahe-loading-note { font-size: 13.5px; color: var(--text-lo); margin-top: 6px; line-height: 1.5; }
.ahe-win-skel { cursor: default; pointer-events: none; }
.ahe-skel-tag { display: block; width: 92px; height: 22px; border-radius: 999px; }
.ahe-skel-dates { width: 70%; max-width: 260px; height: 20px; }
.ahe-skel-sub { width: 45%; max-width: 170px; height: 14px; }
.ahe-skel-price { display: block; width: 96px; height: 24px; }

/* empty state */
.ahe-winempty { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-btn); padding: 26px 22px; text-align: center; margin-bottom: 12px; }
.ahe-winempty-t { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--text-hi); margin: 0 0 6px; }
.ahe-winempty-p { font-size: 14.5px; color: var(--text-mid); margin: 0 0 16px; line-height: 1.5; }

/* own-dates card */
.ahe-own { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-btn); padding: 14px 16px; margin-bottom: 12px; }
.ahe-own-label { font-size: 13.5px; font-weight: 700; color: var(--text-hi); margin-bottom: 10px; }
.ahe-own-dates { display: flex; gap: 10px; }
.ahe-own-dates .form-control { flex: 1 1 0; }
.ahe-own-submit { margin-top: 12px; }

@media (min-width: 768px) {
  .ahe-when-title { font-size: 26px; }
  .ahe-win { padding: 16px 22px; }
  .ahe-win-dates { font-size: 17px; }
  .ahe-bar-title { font-size: 18px; }
}
