* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #eef1f7;
  color: #1a2233;
  line-height: 1.5;
}

header {
  background: linear-gradient(135deg, #101c3d 0%, #1e3a8a 100%);
  color: #fff;
  padding: 28px 32px;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.subtitle {
  margin: 4px 0 0;
  color: #aab8dd;
  font-size: 0.9rem;
}

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* ---- Tabs ---- */

.tabs {
  background: #101c3d;
  padding: 0 32px;
  display: flex;
  gap: 4px;
}

.tabs .tab {
  background: transparent;
  border: none;
  color: #aab8dd;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.tabs .tab:hover {
  color: #fff;
}

.tabs .tab.active {
  color: #fff;
  border-bottom-color: #5b8def;
}

.test-hint {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: #5a6780;
  background: #fdf7e7;
  border: 1px solid #eddfae;
  border-radius: 6px;
  padding: 8px 12px;
}

/* ---- Search form ---- */

.search-panel {
  background: #fff;
  border: 1px solid #dde3ee;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(16, 28, 61, 0.06);
}

.trip-type {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  position: relative;
}

.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #5a6780;
  margin-bottom: 4px;
}

.field input,
.field select {
  padding: 8px 10px;
  border: 1px solid #c6cede;
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
}

.field input:focus,
.field select:focus {
  outline: 2px solid #3b6fe0;
  outline-offset: -1px;
}

.suggestions {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  background: #fff;
  border: 1px solid #c6cede;
  border-radius: 6px;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 6px 16px rgba(26, 34, 51, 0.12);
}

.suggestions:empty {
  display: none;
}

.suggestions li {
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.9rem;
}

.suggestions li:hover,
.suggestions li.active {
  background: #eef2fb;
}

.suggestions .iata {
  font-weight: 700;
  color: #3b6fe0;
  margin-right: 6px;
}

#search-btn {
  background: #3b6fe0;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

#search-btn:hover {
  background: #2f5cc0;
}

#search-btn:disabled {
  background: #9db4e8;
  cursor: wait;
}

/* ---- Status / errors ---- */

#status {
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

#status.loading {
  background: #eef2fb;
  border: 1px solid #c3d2f2;
}

#status.error {
  background: #fdeeee;
  border: 1px solid #f0c4c4;
  color: #8f2626;
  white-space: pre-wrap;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85rem;
}

#results-meta {
  font-size: 0.85rem;
  color: #5a6780;
  margin-bottom: 12px;
}

.no-results {
  background: #fff;
  border: 1px solid #dde3ee;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  color: #5a6780;
}

/* ---- Collapsible panels (request details, etc.) ---- */

.panel-details {
  background: #fff;
  border: 1px solid #dde3ee;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.panel-details > summary {
  cursor: pointer;
  font-weight: 600;
  color: #3b6fe0;
}

/* ---- Offer cards ---- */

.offer-card {
  background: #fff;
  border: 1px solid #dde3ee;
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(16, 28, 61, 0.06);
}

.offer-main {
  display: flex;
  gap: 24px;
  align-items: stretch;
}

.offer-left {
  flex: 1;
  min-width: 0;
}

.offer-side {
  flex: 0 0 auto;
  min-width: 170px;
  border-left: 1px dashed #dde3ee;
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  text-align: right;
  gap: 4px;
}

@media (max-width: 640px) {
  .offer-main {
    flex-direction: column;
    gap: 12px;
  }
  .offer-side {
    border-left: none;
    border-top: 1px dashed #dde3ee;
    padding: 12px 0 0;
    align-items: flex-start;
    text-align: left;
  }
}

.airline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  margin-bottom: 10px;
}

.airline img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.airline-code {
  color: #8b94a8;
  font-weight: 400;
  font-size: 0.85rem;
}

.price {
  font-size: 1.45rem;
  font-weight: 700;
  color: #1a7f4b;
}

.price-breakdown {
  font-size: 0.78rem;
  color: #5a6780;
}

.expires {
  font-size: 0.75rem;
  color: #8b94a8;
}

.offer-id {
  font-size: 0.75rem;
  color: #8b94a8;
  font-family: ui-monospace, Consolas, monospace;
  margin: 10px 0 6px;
}

/* ---- Hotel cards ---- */

.hotel-photo {
  flex: 0 0 auto;
  width: 140px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  align-self: flex-start;
}

@media (max-width: 640px) {
  .hotel-photo {
    width: 100%;
    height: 160px;
  }
}

.hotel-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.hotel-address {
  font-size: 0.83rem;
  color: #5a6780;
}

.hotel-stay {
  font-size: 0.83rem;
  color: #5a6780;
  margin-top: 4px;
}

.hotel-desc {
  font-size: 0.85rem;
  color: #4a5670;
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Slice timeline ---- */

.slice {
  border-top: 1px solid #eef1f7;
  padding: 12px 0;
}

.slice:first-of-type {
  border-top: none;
}

.timeline {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.tl-point {
  text-align: center;
}

.tl-time {
  font-size: 1.15rem;
  font-weight: 700;
}

.tl-airport {
  font-size: 0.8rem;
  color: #5a6780;
  font-weight: 600;
}

.tl-middle {
  flex: 1;
  min-width: 120px;
  max-width: 260px;
  text-align: center;
  font-size: 0.75rem;
  color: #5a6780;
}

.tl-line {
  height: 2px;
  background: #c6cede;
  border-radius: 2px;
  margin: 3px 0;
  position: relative;
}

.tl-line::before,
.tl-line::after {
  content: '';
  position: absolute;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b6fe0;
}

.tl-line::before {
  left: 0;
}

.tl-line::after {
  right: 0;
}

.tl-meta {
  font-size: 0.78rem;
  color: #5a6780;
  text-align: right;
  margin-left: auto;
}

.fare-brand {
  display: inline-block;
  background: #eef2fb;
  color: #2f5cc0;
  border-radius: 4px;
  padding: 1px 8px;
  font-weight: 600;
  margin-top: 2px;
}

.segments-details {
  margin-top: 6px;
  font-size: 0.83rem;
}

.segments-details > summary {
  cursor: pointer;
  color: #3b6fe0;
}

.segment-list {
  margin: 6px 0 0;
  padding-left: 18px;
  color: #5a6780;
}

.segment-list li {
  margin-bottom: 4px;
}

/* ---- Chips ---- */

.offer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip {
  font-size: 0.75rem;
  background: #f0f3f9;
  border: 1px solid #dde3ee;
  color: #4a5670;
  border-radius: 999px;
  padding: 2px 10px;
}

.chip.good {
  background: #e9f7ef;
  border-color: #bfe5cf;
  color: #1a7f4b;
}

.chip.bad {
  background: #fdf0ee;
  border-color: #f0cdc4;
  color: #a2452f;
}

/* ---- Offer expandable sections ---- */

.offer-details {
  border-top: 1px solid #eef1f7;
  margin-top: 8px;
  padding-top: 8px;
  font-size: 0.85rem;
}

.offer-details > summary {
  cursor: pointer;
  color: #3b6fe0;
  font-weight: 600;
}

/* ---- JSON tree ---- */

.tree {
  margin-top: 8px;
  font-size: 0.83rem;
  font-family: ui-monospace, Consolas, monospace;
}

.tree-row {
  display: flex;
  gap: 12px;
  padding: 3px 6px;
  border-bottom: 1px solid #f4f6fa;
}

.tree-row:hover {
  background: #f7f9fd;
}

.tk {
  flex: 0 0 220px;
  color: #4a5670;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.tv {
  overflow-wrap: anywhere;
}

.tv.null,
.tv.empty {
  color: #a3adc2;
  font-style: italic;
}

.tv.bool-true {
  color: #1a7f4b;
  font-weight: 600;
}

.tv.bool-false {
  color: #a2452f;
  font-weight: 600;
}

.tv.link {
  color: #3b6fe0;
}

.tree-item {
  padding: 2px 0;
}

.tree-item > summary {
  cursor: pointer;
  font-weight: 600;
  color: #2f5cc0;
  padding: 3px 6px;
}

.tree-item > summary:hover {
  background: #f7f9fd;
}

.tree-item .hint {
  color: #8b94a8;
  font-weight: 400;
}

.tree-nest {
  margin-left: 18px;
  border-left: 2px solid #e4e9f4;
  padding-left: 8px;
}

/* ---- Raw JSON ---- */

pre.offer-json,
#raw-response {
  background: #101623;
  color: #d7e0f2;
  border-radius: 8px;
  padding: 14px;
  overflow-x: auto;
  font-size: 0.78rem;
  max-height: 480px;
  overflow-y: auto;
  margin: 10px 0 0;
}

#raw-response-panel {
  margin-top: 24px;
}
