/* ─── Trip Microsite ─── */

:root {
  --bg: #0c0c10;
  --surface: #151519;
  --surface-2: #1c1c22;
  --border: #27272f;
  --border-2: #35353f;

  --text: #dcdce0;
  --text-2: #9494a0;
  --text-3: #5c5c6a;

  --blue: #5b8def;
  --green: #3dcc73;
  --amber: #e5a930;
  --red: #e55050;
  --purple: #9580f0;

  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --mono: 'SF Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ─── */
.wrap { max-width: 960px; margin: 0 auto; padding: 20px 16px; }
@media (min-width: 768px) { .wrap { padding: 28px 32px; } }

/* ─── Top bar ─── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; height: 42px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
@media (min-width: 768px) { .topbar { padding: 8px 32px; } }
.topbar-title { font-size: 13px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 12px; }
.topbar-email { color: var(--text-3); display: none; }
@media (min-width: 640px) { .topbar-email { display: inline; } }
.topbar-link { color: var(--text-3); font-size: 12px; }
.topbar-link:hover { color: var(--text); text-decoration: none; }
.back-link { color: var(--text-2); font-size: 13px; font-weight: 500; }
.back-link:hover { color: var(--text); text-decoration: none; }

/* ─── Login / Error ─── */
.page-center { display: flex; align-items: center; justify-content: center; min-height: 100dvh; padding: 16px; }
.center-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 40px 32px; text-align: center; width: 100%; max-width: 360px;
}
.center-card h1 { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.center-card .sub { color: var(--text-2); font-size: 13px; margin-bottom: 24px; }
.err-box {
  background: rgba(229, 80, 80, 0.08); color: var(--red);
  border: 1px solid rgba(229, 80, 80, 0.2); border-radius: 6px;
  padding: 8px 14px; margin-bottom: 18px; font-size: 13px;
}
.g-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff; color: #1a1a1a; border: none; border-radius: 6px;
  padding: 10px 24px; font-size: 13px; font-weight: 500; cursor: pointer;
}
.g-btn:hover { box-shadow: 0 2px 12px rgba(91, 141, 239, 0.2); color: #1a1a1a; text-decoration: none; }
.g-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ─── Search ─── */
.search-box { margin-bottom: 20px; }
.search-input {
  width: 100%; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 13px; font-family: var(--font); outline: none;
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus { border-color: var(--blue); }
.search-empty { color: var(--text-3); text-align: center; padding: 32px 16px; display: none; font-size: 13px; }

/* ─── Landing ─── */
.page-stats { color: var(--text-3); font-size: 12px; margin-bottom: 14px; }

.section-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3); margin-bottom: 8px;
}
.section-label .pill {
  background: var(--blue); color: #fff; font-size: 10px; font-weight: 700;
  padding: 0 6px; border-radius: 6px; margin-left: 4px; letter-spacing: 0;
}

.trip-section { margin-bottom: 32px; }

/* ─── Trip grid ─── */
.trip-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
@media (min-width: 520px) { .trip-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 820px) { .trip-grid { grid-template-columns: repeat(3, 1fr); } }

/* ─── Trip card ─── */
.trip-card {
  display: block;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}
.trip-card:hover {
  border-color: var(--border-2); background: var(--surface-2);
  text-decoration: none; color: var(--text);
}

.trip-card .name { font-size: 14px; font-weight: 600; line-height: 1.3; margin-bottom: 2px; }
.trip-card .meta { font-size: 12px; color: var(--text-2); margin-bottom: 1px; }
.trip-card .dest { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip-card .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.trip-card .who { font-size: 11px; color: var(--text-3); }

/* Status left stripe */
.trip-card.s-confirmed { border-left: 2px solid var(--green); }
.trip-card.s-planning  { border-left: 2px solid var(--amber); }
.trip-card.s-completed { border-left: 2px solid var(--text-3); }

/* ─── Past trips: compact rows ─── */
.past-section .trip-grid { display: flex; flex-direction: column; gap: 2px; }
.past-section .trip-card {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; opacity: 0.55; border-radius: 6px;
}
.past-section .trip-card:hover { opacity: 1; }
.past-section .name { font-size: 13px; margin-bottom: 0; }
.past-section .meta { font-size: 11px; margin-bottom: 0; display: none; }
@media (min-width: 640px) { .past-section .meta { display: inline; } }
.past-section .dest { display: none; }
.past-section .foot { margin-left: auto; margin-top: 0; }

.year-sep {
  font-size: 12px; font-weight: 600; color: var(--text-3);
  padding: 14px 0 4px; border-bottom: 1px solid var(--border);
}
.trip-card.search-hidden, .year-sep.search-hidden { display: none; }

/* ─── Badges ─── */
.badge {
  display: inline-block; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 1px 6px; border-radius: 3px; white-space: nowrap;
}
.badge-confirmed { background: rgba(61, 204, 115, 0.1); color: var(--green); }
.badge-planning  { background: rgba(229, 169, 48, 0.1); color: var(--amber); }
.badge-completed { background: rgba(92, 92, 106, 0.15); color: var(--text-3); }
.badge-scope     { background: rgba(149, 128, 240, 0.1); color: var(--purple); }

/* ─── Hero ─── */
.hero {
  border-bottom: 1px solid var(--border);
  padding: 0 0 20px; margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(20px, 3vw + 8px, 28px); font-weight: 700;
  line-height: 1.2; margin-bottom: 6px; letter-spacing: -0.02em;
}
.hero-meta { font-size: 13px; color: var(--text-2); margin-bottom: 2px; }
.hero-meta .hl { color: var(--blue); font-weight: 500; }
.hero-badges { display: flex; gap: 6px; margin-top: 10px; }

/* ─── Alerts ─── */
.alerts-section { margin-bottom: 16px; }
.alerts-section summary {
  font-size: 12px; font-weight: 600; color: var(--amber);
  cursor: pointer; list-style: none; padding: 4px 0; user-select: none;
}
.alerts-section summary::-webkit-details-marker { display: none; }
.alerts-section summary::marker { display: none; content: ''; }
.alerts-section summary::after { content: ' \25BE'; font-size: 10px; }
.alerts-section[open] summary::after { content: ' \25B4'; }
.alert-item {
  padding: 8px 12px; border-radius: 6px; margin-bottom: 4px; font-size: 12px;
  border-left: 2px solid;
}
.alert-item.warn { background: rgba(229, 169, 48, 0.05); border-color: var(--amber); color: var(--text-2); }
.alert-item.info { background: rgba(91, 141, 239, 0.05); border-color: var(--blue); color: var(--text-2); }
.alert-item strong { color: var(--text); }

/* ─── Section (booking/timeline) ─── */
.section {
  margin-bottom: 4px;
}
.section > summary {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; font-size: 13px; font-weight: 600; color: var(--text);
  cursor: pointer; list-style: none; user-select: none;
  border-bottom: 1px solid transparent;
}
.section > summary::-webkit-details-marker { display: none; }
.section > summary::marker { display: none; content: ''; }
.section > summary:hover { color: var(--blue); }
.section > summary .cnt { color: var(--text-3); font-weight: 400; font-size: 12px; }
.section > summary .chv {
  margin-left: auto; color: var(--text-3); font-size: 10px;
  transition: transform 0.15s;
}
.section[open] > summary .chv { transform: rotate(180deg); }
.section[open] > summary { border-bottom: 1px solid var(--border); }
.section > .body { padding: 8px 0; }

/* Type dot before section title */
.section > summary::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-3);
}
.section.t-flight > summary::before    { background: #5b8def; }
.section.t-hotel > summary::before     { background: #e5a930; }
.section.t-train > summary::before     { background: #3dcc73; }
.section.t-transfer > summary::before  { background: var(--purple); }
.section.t-event > summary::before     { background: #e55083; }
.section.t-excursion > summary::before { background: #30c9b0; }
.section.t-restaurant > summary::before{ background: #e56b6b; }
.section.t-esim > summary::before      { background: #7070e5; }
.section.t-insurance > summary::before { background: #808098; }
.section.t-budget > summary::before    { background: var(--blue); }
.section.t-notes > summary::before     { background: var(--text-2); }

/* ─── Booking card ─── */
.bcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 6px;
}
.bcard-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.bcard-head strong { font-size: 13px; font-weight: 600; }
.bcard-route { font-size: 13px; color: var(--text-2); margin-bottom: 6px; }

.tag {
  font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 1px 5px; border-radius: 3px; background: rgba(91, 141, 239, 0.1); color: var(--blue);
}
.tag-confirmed { background: rgba(61, 204, 115, 0.1); color: var(--green); }
.tag-cancelled { background: rgba(229, 80, 80, 0.1); color: var(--red); }

/* ─── Info grid ─── */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 12px; }
@media (min-width: 500px) { .info-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); } }
.info-item { padding: 3px 0; }
.info-item.full { grid-column: 1 / -1; }
.info-label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); line-height: 1.6; }
.info-value { font-size: 13px; }

/* ─── Booking reference ─── */
.ref {
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  background: rgba(91, 141, 239, 0.08); color: var(--blue);
  padding: 1px 6px; border-radius: 3px;
  cursor: pointer; user-select: all;
  transition: background 0.15s;
}
.ref:hover { background: rgba(91, 141, 239, 0.18); }
.ref.copied { background: rgba(61, 204, 115, 0.12); color: var(--green); }

/* ─── Extras ─── */
.extras { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.extras-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 4px; }

/* ─── Timeline ─── */
.timeline { padding: 8px 0 0 20px; position: relative; }
.timeline::before {
  content: ''; position: absolute; left: 5px; top: 8px; bottom: 0;
  width: 1px; background: var(--border);
}

.tl-day { margin-bottom: 14px; }
.tl-day-head { font-size: 12px; font-weight: 600; color: var(--blue); margin-bottom: 2px; }

.tl-entry { position: relative; margin-bottom: 1px; }
.tl-dot {
  position: absolute; left: -18px; top: 8px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-3); border: 1.5px solid var(--bg);
}
.tl-dot.c-flight       { background: #5b8def; }
.tl-dot.c-hotel_checkin, .tl-dot.c-hotel_checkout { background: #e5a930; }
.tl-dot.c-train        { background: #3dcc73; }
.tl-dot.c-transfer     { background: var(--purple); }
.tl-dot.c-event        { background: #e55083; }
.tl-dot.c-excursion    { background: #30c9b0; }
.tl-dot.c-restaurant   { background: #e56b6b; }

.tl-entry > summary {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px; border-radius: 4px; font-size: 13px;
  cursor: pointer; list-style: none; transition: background 0.1s;
}
.tl-entry > summary::-webkit-details-marker { display: none; }
.tl-entry > summary::marker { display: none; content: ''; }
.tl-entry > summary:hover { background: var(--surface-2); }

.tl-time { font-size: 11px; color: var(--text-3); min-width: 34px; font-variant-numeric: tabular-nums; }
.tl-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tl-detail {
  margin: 2px 0 4px 42px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
}

/* ─── Budget ─── */
.budget-totals { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.budget-total { font-size: 18px; font-weight: 700; color: var(--blue); letter-spacing: -0.01em; }
.budget-row { display: flex; align-items: center; padding: 4px 0; font-size: 12px; border-bottom: 1px solid var(--border); gap: 10px; }
.budget-cat { color: var(--text-2); text-transform: capitalize; flex: 1; }
.budget-bar { flex: 0 0 60px; height: 3px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
@media (max-width: 480px) { .budget-bar { display: none; } }
.budget-bar-fill { height: 100%; background: var(--blue); border-radius: 2px; }
.budget-amt { font-weight: 500; text-align: right; min-width: 80px; font-variant-numeric: tabular-nums; }
.budget-date { font-size: 11px; color: var(--text-3); margin-top: 6px; }

/* ─── Notes ─── */
.note-box {
  padding: 8px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; margin-bottom: 4px; font-size: 13px;
  color: var(--text-2); white-space: pre-wrap;
}

/* ─── Misc ─── */
.empty-msg { color: var(--text-3); font-size: 13px; padding: 20px 0; text-align: center; }

.expand-link { font-size: 11px; font-weight: 400; color: var(--blue); cursor: pointer; }
.expand-link:hover { text-decoration: underline; }

.back-to-top {
  position: fixed; bottom: 16px; right: 16px; width: 32px; height: 32px;
  border-radius: 6px; background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
  z-index: 50;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { background: var(--surface-2); color: var(--text); }

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ─── Print ─── */
@media print {
  body { background: #fff; color: #000; font-size: 11px; }
  .topbar, .back-to-top, .search-box, .expand-link { display: none; }
  .hero { border-color: #ddd; }
  .bcard, .note-box, .alert-item, .tl-detail { border-color: #ddd; }
  a { color: #000; }
  .ref { background: #eee; color: #333; }
}
