/* ==========================================================================
   BeyondJourney design system
   Tokens first, then primitives, then components. Pages compose these and add
   no new colours or spacing values of their own.
   ========================================================================== */

:root {
    /* Colour ------------------------------------------------------------- */
    --bg:            #f4f6fa;
    --surface:       #ffffff;
    --surface-alt:   #f8fafc;
    --border:        #e2e8f0;
    --border-strong: #cbd5e1;

    --text:          #0f172a;
    --text-muted:    #64748b;
    --text-subtle:   #94a3b8;

    /* Beyond Journey teal, carried over from the existing storefront. */
    --brand:         #029e9d;
    --brand-hover:   #027d7c;
    --brand-dark:    #016463;
    --brand-soft:    #e6f6f6;
    --accent:        #ff7a45;

    --success:       #047857;
    --success-soft:  #ecfdf5;
    --warning:       #b45309;
    --warning-soft:  #fffbeb;
    --danger:        #b91c1c;
    --danger-soft:   #fef2f2;

    /* Spacing — 4px scale ------------------------------------------------ */
    --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
    --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

    /* Type --------------------------------------------------------------- */
    --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    --fs-xs: 12px; --fs-sm: 13px; --fs-base: 14px;
    --fs-md: 16px; --fs-lg: 20px; --fs-xl: 26px;

    --radius:    10px;
    --radius-sm: 6px;
    --shadow:    0 1px 2px rgba(15, 23, 42, .06), 0 4px 12px rgba(15, 23, 42, .05);
    --shadow-lg: 0 8px 28px rgba(15, 23, 42, .10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: var(--fs-base);
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }

/* Layout ----------------------------------------------------------------- */
.container { max-width: 1120px; margin: 0 auto; padding: 0 var(--s5); }

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
}
.site-header .inner {
    display: flex; align-items: center; gap: var(--s6);
    height: 60px; max-width: 1120px; margin: 0 auto; padding: 0 var(--s5);
}
/* Logo only - the image carries the wordmark, so no text is rendered beside it. */
.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { height: 40px; width: auto; display: block; }

/* Hero — used on the landing page only. */
.hero {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff; border-radius: var(--radius);
    padding: var(--s7) var(--s6); margin-bottom: var(--s6);
    box-shadow: var(--shadow-lg);
}
.hero h1 { color: #fff; font-size: 30px; margin-bottom: var(--s3); }
.hero p { margin: 0; opacity: .92; max-width: 620px; font-size: var(--fs-md); }

/* Product tiles */
.tile { display: block; text-decoration: none; color: inherit; overflow: hidden; }
.tile .tile-top {
    padding: var(--s6) var(--s5);
    background: var(--brand-soft);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: var(--s4);
}
.tile .icon { font-size: 30px; line-height: 1; }
.tile h2 { color: var(--brand-dark); }

.nav { display: flex; gap: var(--s4); margin-left: auto; }
.nav a {
    color: var(--text-muted); text-decoration: none; font-weight: 500;
    padding: var(--s2) var(--s3); border-radius: var(--radius-sm);
}
.nav a:hover { background: var(--surface-alt); color: var(--text); }
.nav a.active { color: var(--brand); background: var(--brand-soft); }

main { padding: var(--s6) 0 var(--s8); }

/* Cards ------------------------------------------------------------------ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-body { padding: var(--s5); }
.card-header {
    padding: var(--s4) var(--s5);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
}

/* Forms ------------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: var(--s2); }
.field label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted);
               text-transform: uppercase; letter-spacing: .04em; }

.input, select.input {
    width: 100%; padding: 10px var(--s3);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-family: inherit; font-size: var(--fs-base); color: var(--text);
    background: var(--surface); transition: border-color .12s, box-shadow .12s;
}
.input:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(2, 158, 157, .16);
}
.input:disabled { background: var(--surface-alt); color: var(--text-subtle); }

.form-grid { display: grid; gap: var(--s4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

/* Buttons ---------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
    padding: 10px var(--s5); border-radius: var(--radius-sm);
    font-family: inherit; font-size: var(--fs-base); font-weight: 600;
    border: 1px solid transparent; cursor: pointer;
    transition: background .12s, border-color .12s, opacity .12s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-alt); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { opacity: .9; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: 6px var(--s4); font-size: var(--fs-sm); }

/* Badges ----------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: var(--s1);
    padding: 2px var(--s2); border-radius: 999px;
    font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
}
.badge-neutral { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }
.badge-brand   { background: var(--brand-soft);  color: var(--brand); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }

/* Alerts ----------------------------------------------------------------- */
.alert {
    padding: var(--s3) var(--s4); border-radius: var(--radius-sm);
    border: 1px solid; display: flex; gap: var(--s3); align-items: flex-start;
}
.alert-title { font-weight: 600; margin-bottom: 2px; }
.alert-info    { background: var(--brand-soft);   border-color: #c7d2fe; color: #1e3a8a; }
.alert-success { background: var(--success-soft); border-color: #a7f3d0; color: var(--success); }
.alert-warning { background: var(--warning-soft); border-color: #fde68a; color: var(--warning); }
.alert-danger  { background: var(--danger-soft);  border-color: #fecaca; color: var(--danger); }

/* Steps ------------------------------------------------------------------ */
.steps { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s5); flex-wrap: wrap; }
.step {
    display: flex; align-items: center; gap: var(--s2);
    padding: var(--s2) var(--s4); border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border);
    font-size: var(--fs-sm); color: var(--text-subtle); font-weight: 500;
}
.step .n {
    width: 20px; height: 20px; border-radius: 50%;
    display: grid; place-items: center; font-size: 11px; font-weight: 700;
    background: var(--border); color: var(--text-muted);
}
.step.active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.step.active .n { background: var(--brand); color: #fff; }
.step.done { border-color: #a7f3d0; color: var(--success); background: var(--success-soft); }
.step.done .n { background: var(--success); color: #fff; }
.step-sep { color: var(--text-subtle); }

/* Result rows ------------------------------------------------------------ */
.result {
    display: grid; grid-template-columns: 150px 1fr auto;
    gap: var(--s5); align-items: center;
    padding: var(--s4) var(--s5);
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); margin-bottom: var(--s3);
    transition: border-color .12s, box-shadow .12s;
}
.result:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.result.selected { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(2,158,157,.18); }

.airline { font-weight: 600; }
.airline small { display: block; color: var(--text-subtle); font-weight: 400; font-size: var(--fs-xs); }

.journey { display: flex; align-items: center; gap: var(--s4); }
.time { font-size: var(--fs-md); font-weight: 600; }
.time small { display: block; font-size: var(--fs-xs); color: var(--text-subtle); font-weight: 400; }
.duration { text-align: center; color: var(--text-muted); font-size: var(--fs-xs); min-width: 110px; }
.duration .line { height: 1px; background: var(--border-strong); margin: var(--s1) 0; position: relative; }
.duration .line::after {
    content: ""; position: absolute; right: 0; top: -2px;
    border: 3px solid transparent; border-left-color: var(--border-strong);
}

.price { text-align: right; }
.price .amount { font-size: var(--fs-lg); font-weight: 700; }
.price .cur { font-size: var(--fs-xs); color: var(--text-subtle); }

/* Voucher ---------------------------------------------------------------- */
.voucher-head {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff; border-radius: var(--radius) var(--radius) 0 0;
    padding: var(--s5); display: flex; justify-content: space-between;
    align-items: center; gap: var(--s5); flex-wrap: wrap;
}
.voucher-head h2 { color: #fff; margin-bottom: var(--s1); }
.voucher-head .sub { opacity: .9; font-size: var(--fs-sm); }

.pnr-box {
    background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .35);
    border-radius: var(--radius-sm); padding: var(--s3) var(--s5); text-align: center;
}
.pnr-box .label { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.pnr-box .value {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 24px; font-weight: 700; letter-spacing: .08em; line-height: 1.2;
}

.voucher-section {
    padding: var(--s5); border-bottom: 1px solid var(--border);
}
.voucher-section:last-child { border-bottom: 0; }
.voucher-section h3 {
    font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .07em;
    color: var(--text-muted); margin-bottom: var(--s4);
}

/* One flight leg */
.seg { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--s5); align-items: center; }
.seg + .seg { margin-top: var(--s4); padding-top: var(--s4); border-top: 1px dashed var(--border); }
.seg .port { font-size: 22px; font-weight: 700; letter-spacing: .02em; }
.seg .when { font-size: var(--fs-md); font-weight: 600; }
.seg .date { color: var(--text-muted); font-size: var(--fs-sm); }
.seg .mid { text-align: center; color: var(--text-muted); font-size: var(--fs-xs); min-width: 130px; }
.seg .mid .bar { height: 1px; background: var(--border-strong); margin: var(--s2) 0; }
.seg-meta {
    margin-top: var(--s3); display: flex; gap: var(--s2);
    flex-wrap: wrap; align-items: center;
}
.layover {
    margin: var(--s3) 0; padding: var(--s2) var(--s3); border-radius: var(--radius-sm);
    background: var(--surface-alt); color: var(--text-muted); font-size: var(--fs-xs);
}

/* Tables */
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.data th {
    text-align: left; font-size: var(--fs-xs); text-transform: uppercase;
    letter-spacing: .05em; color: var(--text-muted); font-weight: 600;
    padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border);
}
table.data td { padding: var(--s3); border-bottom: 1px solid var(--border); }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; }
table.data tr.total td { font-weight: 700; font-size: var(--fs-md); border-top: 2px solid var(--border-strong); }

/* Hotel voucher --------------------------------------------------------- */
.hotel-name { font-size: var(--fs-xl); font-weight: 700; line-height: 1.25; }
.stars { color: #f5a623; letter-spacing: .1em; font-size: var(--fs-md); white-space: nowrap; }

.stay-grid {
    display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--s5);
    align-items: stretch; text-align: center;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: var(--s5); background: var(--surface-alt);
}
.stay-grid .cell .label {
    font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
    color: var(--text-muted); margin-bottom: var(--s2);
}
.stay-grid .cell .date { font-size: var(--fs-lg); font-weight: 700; }
.stay-grid .cell .time { color: var(--text-muted); font-size: var(--fs-sm); margin-top: var(--s1); }
.stay-nights {
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: 0 var(--s5); border-left: 1px dashed var(--border-strong);
    border-right: 1px dashed var(--border-strong); color: var(--text-muted);
    font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em;
}
.stay-nights .n { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.1; }

.fact-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s4); }
.fact-grid .fact .subtle { margin-bottom: 2px; }
@media (max-width: 720px) {
    .stay-grid { grid-template-columns: 1fr; }
    .stay-nights { border: 0; border-top: 1px dashed var(--border-strong);
                   border-bottom: 1px dashed var(--border-strong); padding: var(--s3) 0; }
    .fact-grid { grid-template-columns: repeat(2, 1fr); }
}

.voucher-note {
    border-left: 3px solid var(--brand); background: var(--surface-alt);
    padding: var(--s3) var(--s4); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: var(--fs-sm); color: var(--text-muted);
}
.voucher-foot {
    padding: var(--s4) var(--s5); background: var(--surface-alt);
    border-radius: 0 0 var(--radius) var(--radius);
    display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap;
    font-size: var(--fs-xs); color: var(--text-subtle);
}
ul.checklist { margin: 0; padding-left: 18px; font-size: var(--fs-sm); color: var(--text-muted); }
ul.checklist li { margin-bottom: var(--s2); }
ul.checklist li:last-child { margin-bottom: 0; }

@media print {
    .site-header, .steps, .btn, #cancel-result { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border-color: #999; }
    .voucher-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .stay-grid, .voucher-foot, .voucher-note {
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .voucher-section { break-inside: avoid; }
}

/* Utility ---------------------------------------------------------------- */
.stack   { display: flex; flex-direction: column; gap: var(--s4); }
.row     { display: flex; gap: var(--s3); align-items: center; }
.row-end { display: flex; gap: var(--s3); align-items: center; justify-content: flex-end; }
.between { display: flex; gap: var(--s3); align-items: center; justify-content: space-between; }
.muted   { color: var(--text-muted); }
.subtle  { color: var(--text-subtle); font-size: var(--fs-sm); }
.mono    { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.hidden  { display: none !important; }
.mt4 { margin-top: var(--s4); } .mt5 { margin-top: var(--s5); } .mb4 { margin-bottom: var(--s4); }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: var(--s2) var(--s4); }
.kv dt { color: var(--text-muted); font-size: var(--fs-sm); }
.kv dd { margin: 0; font-weight: 600; }

.spinner {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
    animation: spin .7s linear infinite;
}
.spinner-dark { border-color: var(--border); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: var(--s7) var(--s5); color: var(--text-muted); }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 900px) {
    .grid-3, .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
    .result { grid-template-columns: 1fr; gap: var(--s3); }
    .price { text-align: left; }
}
@media (max-width: 560px) {
    .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 1fr; }
    .site-header .inner { gap: var(--s4); }
}
