:root {
  --brand: #0a58ca;
  --brand-dark: #062f6e;
  --accent: #ff6b1a;
  --accent-dark: #e25300;
  --bg: #f2f5fa;
  --card: #ffffff;
  --text: #1a2233;
  --muted: #667085;
  --line: #e3e8f0;
  --ok: #148a4c;
  --ok-bg: #e6f6ec;
  --bad: #c4312b;
  --bad-bg: #fdecea;
  --warn-bg: #fff5e6;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(16, 34, 68, .08);
}
.tv-root, .tv-root *, .tv-modal, .tv-modal *, .tv-fallback-bar, .tv-fallback-bar * { box-sizing: border-box; }
.tv-root, .tv-modal, .tv-fallback-bar { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--text); font-size: 15px; line-height: 1.45; }
.tv-root { background: var(--bg); }
:where(.tv-root, .tv-modal, .tv-fallback-bar) a { color: var(--brand); text-decoration: none; }
:where(.tv-root, .tv-modal) :where(h1, h2, h3) { margin: 0; letter-spacing: -.01em; color: var(--text); line-height: 1.2; }
:where(.tv-root) p { margin: 0 0 1em; }
:where(.tv-root, .tv-modal, .tv-fallback-bar) button { font: inherit; cursor: pointer; }
:where(.tv-root, .tv-modal) :where(input, select, textarea) { font: inherit; color: inherit; }
.tv-root .container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* header lives in the theme */
.spacer { flex: 1; }

/* buttons */
.btn { border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 700; background: #eaf1ff; color: var(--brand); transition: .15s; }
.btn:hover { filter: brightness(.96); }
.btn.primary { background: linear-gradient(90deg, var(--accent), #ff8b3d); color: #fff; box-shadow: 0 4px 14px rgba(255, 107, 26, .35); }
.btn.primary:hover { background: var(--accent-dark); }
.btn.blue { background: var(--brand); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.lg { padding: 14px 34px; font-size: 17px; border-radius: 30px; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* hero + search */
.hero { background: linear-gradient(160deg, #041c44 0%, #0a58ca 60%, #3b8cff 100%); padding: 40px 0 90px; color: #fff; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -120px; top: -120px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.14), transparent 70%); }
.hero h1 { color: #fff; font-size: 34px; margin-bottom: 6px; }
.hero p { opacity: .85; margin: 0 0 44px; }
.search-card { background: #fff; color: var(--text); border-radius: 18px; box-shadow: 0 18px 50px rgba(0,0,0,.2); padding: 0 24px 40px; position: relative; }
.tabs { display: flex; gap: 6px; transform: translateY(-50%); background: #fff; width: max-content; border-radius: 14px; padding: 6px; box-shadow: var(--shadow); margin: 0 auto; }
.tabs button { border: 0; background: transparent; padding: 10px 22px; border-radius: 10px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.tabs button.active { background: #eaf1ff; color: var(--brand); }
.fields { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.fields.flight { grid-template-columns: 1.3fr auto 1.3fr 1fr .8fr; }
.fields.hotel { grid-template-columns: 1.6fr 1fr 1fr .8fr; }
.field { padding: 12px 16px; border-right: 1px solid var(--line); min-width: 0; }
.field:last-child { border-right: 0; }
.field label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.field select, .field input { border: 0; outline: 0; font-size: 20px; font-weight: 800; width: 100%; background: transparent; padding: 0; }
.field .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swap { align-self: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #fff; margin: 0 -18px; z-index: 2; color: var(--brand); font-weight: 800; }
.search-go { position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 50%); }

.section { margin: 56px 0 24px; }
.section h2 { font-size: 22px; margin-bottom: 14px; }
.offers { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.offer { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); border-left: 5px solid var(--accent); }
.offer .code { display: inline-block; margin-top: 10px; border: 1.5px dashed var(--brand); color: var(--brand); padding: 4px 10px; border-radius: 8px; font-weight: 800; letter-spacing: .05em; }
.dests { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.dest { height: 150px; border-radius: var(--radius); color: #fff; padding: 14px; display: flex; flex-direction: column; justify-content: flex-end; cursor: pointer; position: relative; overflow: hidden; }
.dest b { font-size: 18px; }
.dest:hover { transform: translateY(-2px); transition: .2s; }

/* results layout */
.page { padding: 22px 0 60px; }
.mini-search { background: linear-gradient(90deg, #041c44, #0a58ca); padding: 14px 0; color: #fff; }
.mini-search form { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.mini-search label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .75; display: block; margin-bottom: 4px; }
.mini-search select, .mini-search input { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 8px; padding: 8px 10px; font-weight: 600; }
.mini-search option { color: var(--text); }
.layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.filters h3 { font-size: 15px; margin: 14px 0 8px; }
.filters h3:first-child { margin-top: 0; }
.check { display: flex; align-items: center; gap: 8px; padding: 5px 0; cursor: pointer; }
.sortbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.sortbar button { border: 1px solid var(--line); background: #fff; border-radius: 30px; padding: 8px 16px; font-weight: 600; color: var(--muted); }
.sortbar button.active { border-color: var(--brand); color: var(--brand); background: #eaf1ff; }

.flight-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 12px; display: grid; grid-template-columns: 1.3fr 2.4fr 1.2fr; gap: 16px; align-items: center; }
.airline { display: flex; gap: 10px; align-items: center; }
.airline-badge { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.timeline { display: flex; align-items: center; gap: 12px; }
.timeline .t { text-align: center; }
.timeline .t b { font-size: 21px; display: block; }
.timeline .mid { flex: 1; text-align: center; font-size: 12px; color: var(--muted); }
.timeline .mid .line { height: 2px; background: var(--line); margin: 6px 0; position: relative; }
.timeline .mid .line::after { content: '✈'; position: absolute; right: -4px; top: -10px; color: var(--brand); font-size: 14px; }
.price-col { text-align: right; }
.price { font-size: 22px; font-weight: 800; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: #eaf1ff; color: var(--brand); margin: 2px 4px 2px 0; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: #b25e00; }
.tag.bad { background: var(--bad-bg); color: var(--bad); }

.hotel-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; display: grid; grid-template-columns: 240px 1fr 200px; overflow: hidden; }
.hotel-img { min-height: 180px; position: relative; display: flex; align-items: flex-end; padding: 12px; color: #fff; font-weight: 700; }
.hotel-body { padding: 16px 18px; }
.hotel-body h3 { font-size: 19px; }
.stars { color: #f5a623; letter-spacing: 1px; }
.rating { display: inline-flex; align-items: center; gap: 6px; }
.rating b { background: var(--brand); color: #fff; padding: 2px 7px; border-radius: 6px; font-size: 13px; }
.hotel-price { border-left: 1px solid var(--line); padding: 16px; text-align: right; display: flex; flex-direction: column; justify-content: center; gap: 6px; }

/* booking */
.book-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.book-grid .panel + .panel { margin-top: 16px; }
.form-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: 0; background: #fff; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(10,88,202,.12); }
.lbl { font-size: 12px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }
.summary .row { display: flex; justify-content: space-between; padding: 7px 0; }
.summary .row.total { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 12px; font-size: 19px; font-weight: 800; }
.pay-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pay-opt { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; cursor: pointer; font-weight: 600; }
.pay-opt.active { border-color: var(--brand); background: #eaf1ff; color: var(--brand); }
.sticky { position: sticky; top: 80px; }

.confirm { text-align: center; padding: 30px 20px; }
.confirm .big { width: 72px; height: 72px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); font-size: 36px; display: grid; place-items: center; margin: 0 auto 12px; }
.ticket { border: 1px dashed var(--line); border-radius: 12px; padding: 16px; margin-top: 16px; text-align: left; }

.trip { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 12px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.trip .icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: #eaf1ff; }
.trip .info { flex: 1; min-width: 200px; }

/* modal + toast */
.tv-modal-bg { position: fixed; inset: 0; background: rgba(10, 20, 40, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.tv-modal { background: #fff; border-radius: 18px; width: 100%; max-width: 420px; padding: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.3); max-height: 92vh; overflow: auto; }
.tv-modal.wide { max-width: 640px; }
.tv-modal h2 { margin-bottom: 4px; }
.tv-modal .stack > * { margin-top: 12px; }
.tv-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1a2233; color: #fff; padding: 12px 20px; border-radius: 10px; z-index: 60; box-shadow: var(--shadow); font-weight: 600; }
.tv-toast.error { background: var(--bad); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .e { font-size: 44px; }
.loader { padding: 40px; text-align: center; color: var(--muted); }

@media (max-width: 900px) {
  .fields.flight, .fields.hotel { grid-template-columns: 1fr 1fr; }
  .field { border-bottom: 1px solid var(--line); }
  .swap { display: none; }
  .layout, .book-grid { grid-template-columns: 1fr; }
  .flight-card { grid-template-columns: 1fr; }
  .price-col { text-align: left; display: flex; justify-content: space-between; align-items: center; }
  .hotel-card { grid-template-columns: 1fr; }
  .hotel-price { border-left: 0; border-top: 1px solid var(--line); text-align: left; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .form-row > :first-child { grid-column: 1 / -1; }
  .hero h1 { font-size: 26px; }
}
@media (max-width: 600px) {
  .fields.flight, .fields.hotel { grid-template-columns: 1fr; }
  .field select, .field input { font-size: 18px; }
  .tabs button { padding: 8px 14px; }
  .search-card { padding: 0 14px 40px; }
  .pay-opts { grid-template-columns: 1fr; }
}

/* buttons in the theme header use the same look */
#tv-user-area { display: flex; align-items: center; gap: 8px; }
#tv-user-area .btn { white-space: nowrap; }

/* bar shown only when a non-TripVim theme is active */
.tv-fallback-bar { display: flex; align-items: center; gap: 6px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tv-fallback-bar > a { padding: 6px 12px; border-radius: 8px; font-weight: 600; }
.tv-fallback-bar > a:hover { background: #eaf1ff; }

/* full-bleed app when it sits inside a normal page */
.tv-root .loader { min-height: 40vh; }
.tv-root .field select, .tv-root .field input { box-shadow: none; min-height: 0; height: auto; }
.tv-root input[type=checkbox], .tv-root input[type=radio] { width: auto; margin: 0; }
@media print {
  .site-header, .site-footer, .tv-fallback-bar, .tv-root .confirm .btn { display: none !important; }
}
@media (max-width: 600px) { .hide-sm { display: none; } }

/* live API results */
.tv-root .tag.live { background: #e7f8ef; color: #0f7a45; }
.tv-root .airline-badge.logo { background: #fff; border: 1px solid var(--line); padding: 5px; }
.tv-root .airline-badge.logo img { width: 100%; height: 100%; object-fit: contain; }
.tv-root .hotel-img { text-shadow: 0 1px 6px rgba(0,0,0,.55); justify-content: space-between; align-items: flex-end; gap: 6px; }
.tv-root .hotel-img .img-tag { text-shadow: none; align-self: flex-start; }

/* online payment */
.tv-root .secure-pay { border: 1.5px solid #cfe0ff; background: #f5f9ff; border-radius: 12px; padding: 12px 14px; }
.tv-root .secure-pay-icons { font-weight: 700; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tv-root .secure-pay-icons span { color: var(--muted); }
.tv-root .secure-pay p { margin: 8px 0 0; }
.tv-modal .spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid #e3e8f0; border-top-color: #0a58ca; margin: 0 auto; animation: tvspin .9s linear infinite; }
@keyframes tvspin { to { transform: rotate(360deg); } }
.tv-modal .muted { color: #667085; }
.tv-modal .btn { border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 700; background: #eaf1ff; color: #0a58ca; }
.tv-modal .btn.primary { background: #ff6b1a; color: #fff; }
