/* =========================================================
   MyLayover Trip Builder (API) — Magical / Modern Glass
   Works with the updated render_builder() markup (mlw-*)
   Keeps existing ml-* hooks for JS + dropdowns
   ========================================================= */

/* --- Design tokens --- */
:root{
  --mlw-bg-0: #0b1220;
  --mlw-bg-1: #0f172a;
  --mlw-bg-2: #111b32;

  --mlw-card: rgba(255,255,255,0.06);
  --mlw-card-2: rgba(255,255,255,0.04);
  --mlw-border: rgba(255,255,255,0.12);

  --mlw-text: rgba(248,250,252,0.96);
  --mlw-muted: rgba(148,163,184,0.95);

  --mlw-accent: #7dd3fc;
  --mlw-accent-2: #38bdf8;
  --mlw-warm: #fbbf24;

  --mlw-shadow: 0 40px 90px rgba(0,0,0,0.55);
  --mlw-shadow-soft: 0 18px 55px rgba(0,0,0,0.35);
}

/* =========================================================
   PAGE / THEME OVERRIDES (keeps everything readable + full page)
   ========================================================= */

/* Hide the theme page title (Trip Engine / Test API Page) so hero is the title */
body.page .entry-title,
body.page .page-title{
  display:none !important;
}

/* Make the page background match so you never see white edges */
body,
#page,
.site,
.site-content,
#content{
  background: #0b1220 !important;
}

html, body { overflow-x: hidden !important; }

/* ===== FULL-BLEED breakout (escape theme container) ===== */
.mlw-trip-builder-shell{
  width: 100vw !important;
  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;
}

/* Full viewport section height + better spacing under nav */
.mlw-trip-builder-shell{
  min-height: calc(100vh - 80px);
  padding-top: 36px;
  padding-bottom: 60px;
}

/* If the theme adds padding above main content, neutralize it */
body.page #primary,
body.page .site-content,
body.page .content-area{
  padding-top: 0 !important;
}

/* --- Page shell background (only around the builder) --- */
.mlw-trip-builder-shell{
  background:
    radial-gradient(900px 520px at 18% -10%, rgba(56,189,248,0.16), transparent 60%),
    radial-gradient(700px 420px at 92% 10%, rgba(251,191,36,0.10), transparent 62%),
    radial-gradient(900px 600px at 50% 120%, rgba(125,211,252,0.10), transparent 60%),
    linear-gradient(180deg, var(--mlw-bg-0), var(--mlw-bg-1));
}

/* --- Main card --- */
.mylayover-trip-builder.ml-api.mlw-trip-builder{
  max-width: 1040px;
  margin: 0 auto;
  padding: 34px 34px 28px;
  border-radius: 28px;

  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  border: 1px solid var(--mlw-border);
  box-shadow: var(--mlw-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  color: var(--mlw-text);
}

/* --- Hero --- */
.mlw-tb-hero{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

/* FORCE readability (fixes “title not visible” issue) */
.mylayover-trip-builder.ml-api .mlw-tb-title{
  margin:0;
  font-size: 34px;
  letter-spacing: -0.3px;
  line-height: 1.1;
  color: rgba(248,250,252,0.98) !important;
  text-shadow: 0 2px 18px rgba(0,0,0,0.55);
}

.mylayover-trip-builder.ml-api .mlw-tb-subtitle{
  margin: 10px 0 0;
  max-width: 52ch;
  color: rgba(226,232,240,0.86) !important;
  font-size: 14px;
  line-height: 1.6;
}

.mlw-tb-badge{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(226,232,240,0.95);
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--mlw-shadow-soft);
}

.mlw-tb-badge-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--mlw-accent), var(--mlw-accent-2));
  box-shadow: 0 0 14px rgba(125,211,252,0.75);
}

/* --- Grid layout --- */
.mlw-tb-grid{
  display:grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 18px;
  align-items:start;
  margin-top: 18px;
}

.mlw-tb-left{
  display:flex;
  flex-direction:column;
  gap: 16px;
}

.mlw-tb-right{
  position: sticky;
  top: 18px;
}

/* --- Step sections --- */
.mlw-step{
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(15,23,42,0.55);
  box-shadow: 0 14px 40px rgba(0,0,0,0.30);
  padding: 18px 18px 16px;

  transform: translateY(0);
  transition: transform .25s ease, opacity .25s ease, filter .25s ease;
}

/* locked state (JS can remove later) */
.mlw-step.is-locked{
  opacity: 0.72;
  filter: saturate(0.8);
}

.mlw-step-head{
  display:flex;
  align-items:center;
  gap: 12px;
  margin-bottom: 10px;
}

.mlw-step-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--mlw-accent), var(--mlw-accent-2));
  box-shadow: 0 0 14px rgba(125,211,252,0.65);
}

.mlw-step-title{
  margin:0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.1px;
}

/* --- Existing row spacing --- */
.mylayover-trip-builder.ml-api .ml-row{ margin: 12px 0; }

.mylayover-trip-builder.ml-api label{
  display:block;
  font-weight: 800;
  margin-bottom: 6px;
  color: rgba(226,232,240,0.95);
  font-size: 13px;
  letter-spacing: 0.2px;
}

/* --- Inputs (magical, soft, premium) --- */
.mylayover-trip-builder.ml-api input[type="text"],
.mylayover-trip-builder.ml-api input[type="date"],
.mylayover-trip-builder.ml-api input[type="number"]{
  width: 100%;
  max-width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(9, 14, 28, 0.55);
  color: rgba(248,250,252,0.96);
  box-sizing: border-box;
  outline: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.mylayover-trip-builder.ml-api input[type="text"]::placeholder{
  color: rgba(148,163,184,0.90);
}

.mylayover-trip-builder.ml-api input[type="text"]:focus,
.mylayover-trip-builder.ml-api input[type="date"]:focus,
.mylayover-trip-builder.ml-api input[type="number"]:focus{
  border-color: rgba(125,211,252,0.70);
  box-shadow:
    0 0 0 1px rgba(125,211,252,0.60),
    0 0 26px rgba(125,211,252,0.22);
  transform: translateY(-1px);
}

/* Selected glow (used by JS pulseSelected) */
.mylayover-trip-builder.ml-api .mlw-selected{
  border-color: rgba(125,211,252,0.75) !important;
  box-shadow:
    0 0 0 1px rgba(125,211,252,0.55),
    0 0 26px rgba(125,211,252,0.22) !important;
}

/* --- Help + notes --- */
.ml-help{
  margin-top: 8px;
  font-size: 12.5px;
  color: rgba(148,163,184,0.92);
}

.ml-inline-note{
  margin-top: 8px;
  font-size: 12.5px;
  color: rgba(148,163,184,0.92);
}

/* --- Buttons (keep your classes, upgrade feel) --- */
.ml-btn{
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: rgba(248,250,252,0.95);
  cursor: pointer;
  width: auto;
  font-weight: 900;
  letter-spacing: 0.2px;
  transition: transform .18s ease, opacity .12s linear, box-shadow .18s ease;
  box-shadow: 0 14px 34px rgba(0,0,0,0.22);
}

.ml-btn:hover{ opacity: .97; transform: translateY(-1px); }
.ml-btn:active{ transform: translateY(0px); }

.ml-btn-primary{
  background: linear-gradient(135deg, var(--mlw-accent-2), var(--mlw-accent), var(--mlw-warm)) !important;
  border: none !important;
  color: rgba(2, 6, 23, 0.96) !important;
  box-shadow: 0 22px 48px rgba(56,189,248,0.35);
}

.ml-btn-secondary{
  border: 1px solid rgba(255,255,255,0.14) !important;
  background: rgba(255,255,255,0.06) !important;
  color: rgba(248,250,252,0.95) !important;
}

.mlw-primary{
  width: 100%;
  justify-content:center;
}

.mlw-secondary{
  width: 100%;
  justify-content:center;
}

/* --- Toggle (reuse your existing markup, style nicer) --- */
.ml-toggle-row{ display:flex; align-items:center; gap:12px; margin-top:6px; }
.ml-toggle-title{ font-weight: 900; color: rgba(226,232,240,0.95); }

.ml-switch{ position:relative; width:52px; height:30px; display:inline-block; }
.ml-switch input{ display:none; }

.ml-slider{
  position:absolute; inset:0;
  background: rgba(255,255,255,0.14);
  border-radius: 999px;
  transition:.2s;
  cursor:pointer;
  border: 1px solid rgba(255,255,255,0.12);
}

.ml-slider:before{
  content:"";
  position:absolute;
  width:24px; height:24px;
  left:3px; top:3px;
  background: rgba(248,250,252,0.95);
  border-radius: 999px;
  transition:.2s;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}

.ml-switch input:checked + .ml-slider{
  background: linear-gradient(90deg, rgba(56,189,248,0.95), rgba(125,211,252,0.95));
  border-color: rgba(255,255,255,0.08);
}
.ml-switch input:checked + .ml-slider:before{ transform: translateX(22px); }

/* --- Stops header + cards --- */
.mlw-stops-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin: 4px 0 10px;
}

.mlw-stops-title{
  margin: 0;
  font-size: 14px;
  font-weight: 900;
  color: rgba(226,232,240,0.95);
}

.mlw-add-stop{
  box-shadow: none;
}

.mlw-stops{
  display:flex;
  flex-direction:column;
  gap: 12px;
}

.mlw-stop-card{
  display:flex;
  gap: 12px;
  align-items:center;
  flex-wrap:wrap;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(9, 14, 28, 0.45);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.mlw-stop-card:hover{
  transform: translateY(-1px);
  border-color: rgba(125,211,252,0.22);
  box-shadow: 0 16px 40px rgba(0,0,0,0.30);
}

#mlStopsApi .ml-stop .ml-stop-location{ flex:1 1 360px; min-width:260px; }
.mlw-stop-nights{
  display:flex;
  align-items:center;
  gap: 10px;
}
#mlStopsApi .ml-stop input[type="number"]{ width:120px; max-width:120px; }
.mlw-stop-nights-label{ color: rgba(148,163,184,0.95); font-weight: 800; }

/* remove button (if your JS adds it) */
#mlStopsApi .ml-stop .mlRemoveStop{
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: rgba(248,250,252,0.95);
  cursor: pointer;
}
#mlStopsApi .ml-stop .mlRemoveStop:hover{ opacity: .97; transform: translateY(-1px); }

/* --- Typeahead dropdown (keep, upgrade) --- */
.ml-loc-wrap{ position:relative; }

.ml-loc-dropdown{
  position:absolute;
  top: calc(100% + 10px);
  left:0; right:0;
  background: rgba(9, 14, 28, 0.92);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  box-shadow: 0 26px 70px rgba(0,0,0,0.55);
  max-height: 280px;
  overflow: auto;
  z-index: 9999;
  display: none;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.ml-loc-item{
  padding: 12px 14px;
  cursor: pointer;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  color: rgba(248,250,252,0.95);
}

.ml-loc-item:hover{ background: rgba(255,255,255,0.06); }

.ml-loc-main{ font-weight: 900; }
.ml-loc-sub{ opacity: .80; font-size: 13px; margin-top:2px; color: rgba(148,163,184,0.95); }
.ml-loc-code{ font-weight: 950; opacity: .90; white-space: nowrap; }

.ml-loc-pill{
  display:inline-block;
  font-size:11px;
  padding:2px 8px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  opacity:.92;
  margin-left: 8px;
  background: rgba(255,255,255,0.06);
}

/* --- Schedule block (now inside step) --- */
.mlw-schedule{
  margin-top: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  padding: 12px;
  background: rgba(9, 14, 28, 0.55);
}

.mlw-schedule-head{
  display:flex;
  justify-content:space-between;
  gap: 10px;
  align-items:baseline;
  margin-bottom: 10px;
}

.mlw-schedule-head h4{
  margin:0;
  font-size: 14px;
  font-weight: 950;
}

.mlw-schedule-note{
  font-size: 12px;
  color: rgba(148,163,184,0.95);
}

.ml-schedule-row{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding: 10px 10px;
  border-radius: 12px;
}
.ml-schedule-row:nth-child(odd){ background: rgba(255,255,255,0.05); }

.ml-schedule-left{ font-weight: 900; }
.ml-schedule-right{ opacity: .88; text-align:right; color: rgba(148,163,184,0.95); }

.ml-schedule-empty{
  opacity: .88;
  font-size: 13px;
  padding: 10px 10px;
  color: rgba(148,163,184,0.95);
}

/* --- Summary card (right column) --- */
.mlw-summary-card{
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(15,23,42,0.55);
  box-shadow: 0 18px 55px rgba(0,0,0,0.35);
  padding: 18px;
}

.mlw-summary-title{
  margin:0 0 10px;
  font-size: 14px;
  font-weight: 950;
  color: rgba(226,232,240,0.95);
}

.mlw-totals{
  margin-top: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  padding: 12px;
  background: rgba(9, 14, 28, 0.45);
}

.ml-totals-row{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding: 10px 10px;
  border-radius: 12px;
}
.ml-totals-row:nth-child(odd){ background: rgba(255,255,255,0.05); }

.ml-totals-k{ font-weight: 950; color: rgba(226,232,240,0.95); }
.ml-totals-v{ opacity: .92; text-align:right; color: rgba(226,232,240,0.95); }

.mlw-actions{
  display:flex;
  flex-direction:column;
  gap: 10px;
  margin-top: 14px;
}

.mlw-summary-foot{
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.mlw-tiny{
  font-size: 12px;
  color: rgba(148,163,184,0.95);
  line-height: 1.5;
}

/* --- Warnings --- */
.ml-warn{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 120, 120, 0.10);
  border: 1px solid rgba(255, 120, 120, 0.25);
  color: rgba(255, 200, 200, 0.95);
  display:none;
}

/* --- Results block --- */
.mlw-results{
  margin-top: 22px;
}

/* Redirect card (from JS) */
.ml-card{
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  padding: 14px;
  background: rgba(9, 14, 28, 0.55);
  margin-top: 14px;
  box-shadow: 0 18px 55px rgba(0,0,0,0.25);
}

.ml-card h4{
  margin: 0 0 8px;
  color: rgba(226,232,240,0.95);
}

/* Links */
.mylayover-trip-builder.ml-api a{
  color: rgba(125,211,252,0.95);
}

/* nicer selection styling */
.mylayover-trip-builder.ml-api ::selection{
  background: rgba(125,211,252,0.25);
}

/* --- Motion preferences --- */
@media (prefers-reduced-motion: reduce){
  .ml-btn,
  .mlw-step,
  .mlw-stop-card,
  .mylayover-trip-builder.ml-api input{
    transition: none !important;
  }
}

/* --- Responsive --- */
@media (max-width: 980px){
  .mylayover-trip-builder.ml-api.mlw-trip-builder{
    padding: 20px;
    border-radius: 22px;
  }

  .mlw-tb-grid{
    grid-template-columns: 1fr;
  }

  .mlw-tb-right{
    position: static;
  }

  .mlw-tb-title{
    font-size: 28px;
  }

  .mlw-trip-builder-shell{
    min-height: auto;
    padding-top: 22px;
  }
}
/* =========================================================
   Trip Builder — FIX step headers visibility (locked + normal)
   ========================================================= */

/* Force step titles + dots to be bright no matter what */
.mylayover-trip-builder.ml-api .mlw-step-head,
.mylayover-trip-builder.ml-api .mlw-step-title{
  color: rgba(248,250,252,0.98) !important;
  opacity: 1 !important;
  text-shadow: 0 2px 18px rgba(0,0,0,0.55);
}

/* If your step header text is an h2/h3/etc inside the head */
.mylayover-trip-builder.ml-api .mlw-step-head h1,
.mylayover-trip-builder.ml-api .mlw-step-head h2,
.mylayover-trip-builder.ml-api .mlw-step-head h3,
.mylayover-trip-builder.ml-api .mlw-step-head h4{
  color: rgba(248,250,252,0.98) !important;
  opacity: 1 !important;
  text-shadow: 0 2px 18px rgba(0,0,0,0.55);
}

/* Keep locked look, but DON'T dim the header */
.mylayover-trip-builder.ml-api .mlw-step.is-locked{
  opacity: 1 !important;
}

/* Dim only the content area below the header (safe even if class names vary) */
.mylayover-trip-builder.ml-api .mlw-step.is-locked > :not(.mlw-step-head){
  opacity: 0.72;
  filter: saturate(0.85);
}

/* Make the little dot pop even on dimmed cards */
.mylayover-trip-builder.ml-api .mlw-step-dot{
  opacity: 1 !important;
  box-shadow: 0 0 18px rgba(125,211,252,0.75);
}
/* Fix: Schedule header inside the step */
.mylayover-trip-builder.ml-api .mlw-schedule-head,
.mylayover-trip-builder.ml-api .mlw-schedule-head h4{
  color: rgba(248,250,252,0.98) !important;
  opacity: 1 !important;
  text-shadow: 0 2px 18px rgba(0,0,0,0.55);
  background: transparent !important; /* just in case Astra/markup adds a bg */
}

/* Also brighten the little note on the right ("Based on...") */
.mylayover-trip-builder.ml-api .mlw-schedule-note{
  color: rgba(226,232,240,0.82) !important;
  opacity: 1 !important;
}