:root {
  --bg-primary: #070e17;
  --bg-secondary: #0d1a29;
  --bg-card: rgba(16, 32, 51, 0.75);
  --bg-card-hover: rgba(22, 44, 70, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(0, 229, 255, 0.3);
  
  --text-main: #f0f4f8;
  --text-muted: #8ba2b8;
  --text-dim: #5c748a;

  --accent-cyan: #00e5ff;
  --accent-gold: #f59e0b;
  --accent-red: #ef4444;
  --accent-green: #10b981;
  --accent-blue: #3b82f6;

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Space Mono', monospace;
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(0, 229, 255, 0.15);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
}

.background-decor {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: 
    radial-gradient(circle at 15% 15%, rgba(0, 229, 255, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(245, 158, 11, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(239, 68, 68, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: -1;
}

/* Header */
.header {
  border-bottom: 1px solid var(--border-color);
  background: rgba(7, 14, 23, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1.25rem 2rem;
}

.header-container {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand-top-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.brand-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.12);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.pulse-container {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulseAnim 2s infinite ease-in-out;
}

@keyframes pulseAnim {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px var(--accent-green); }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.pulse-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-green);
  font-weight: 600;
}

.brand h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand .arrow {
  color: var(--accent-cyan);
  font-size: 1.4rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 180, 216, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #00c4ec 0%, #0088cc 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 180, 216, 0.4);
}

.btn-gold {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #070e17;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.25);
}

.btn-gold:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
}

.btn-icon {
  font-size: 1.1rem;
}

/* Main Container */
.main-container {
  max-width: 1300px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Badges Row */
.badges-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.badge-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
}

.badge-icon {
  font-size: 1.8rem;
}

.badge-card strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text-main);
}

.badge-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.badge-success {
  border-left: 4px solid var(--accent-green);
}

.badge-gold {
  border-left: 4px solid var(--accent-gold);
}

.badge-info {
  border-left: 4px solid var(--accent-cyan);
}

/* Cards & Layout */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  position: relative;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.card-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.timestamp-tag {
  font-size: 0.8rem;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.badge-pill {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  background: rgba(0, 229, 255, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 229, 255, 0.2);
}

/* Two-column Hero */
.grid-two-col {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .grid-two-col {
    grid-template-columns: 1fr;
  }
}

/* Price Hero Card */
.price-hero-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.price-display {
  margin: 1rem 0 1.5rem 0;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.currency-symbol {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

.price-large {
  font-size: 3.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  text-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
}

.price-unit {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.price-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.stat-val {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 0.2rem;
}

.text-green { color: var(--accent-green); }
.text-gold { color: var(--accent-gold); }

.target-control-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.input-group {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  padding: 0.2rem 0.5rem;
}

.input-prefix {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding-left: 0.4rem;
}

.input-group input {
  background: transparent;
  border: none;
  color: #fff;
  padding: 0.5rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 1rem;
  width: 100%;
  outline: none;
}

/* Chart Card */
.chart-card {
  min-height: 380px;
}

.chart-container {
  height: 280px;
  width: 100%;
  position: relative;
}

/* Section headers & toolbar */
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.section-header .section-title {
  margin-bottom: 0;
}

.section-note {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: -0.5rem 0 1rem;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  padding: 0.35rem 0.8rem;
  border-radius: 100px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: pointer;
}

.chip:hover {
  color: var(--text-main);
}

.chip.active {
  background: rgba(0, 229, 255, 0.12);
  border-color: rgba(0, 229, 255, 0.4);
  color: var(--accent-cyan);
}

.select {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
}

/* Hero extras */
.price-change {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  margin-left: 0.5rem;
}

.price-change.up { color: var(--accent-red); }
.price-change.down { color: var(--accent-green); }

.best-summary {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: -0.75rem 0 1.25rem;
}

.best-summary strong {
  color: var(--text-main);
}

.target-alert {
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--accent-green);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.error-banner {
  padding: 0.8rem 1rem;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 0.9rem;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.chart-empty[hidden] {
  display: none;
}

/* Flight option cards */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.empty-card {
  color: var(--text-muted);
  text-align: center;
}

.option-card {
  padding: 1.4rem 1.6rem;
}

.option-card.is-best {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: var(--shadow-card), 0 0 25px rgba(245, 158, 11, 0.12);
}

.best-ribbon {
  position: absolute;
  top: -10px;
  left: 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  background: var(--accent-gold);
  color: #070e17;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
}

.option-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.option-airlines {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.tag-green { color: var(--accent-green); border-color: rgba(16, 185, 129, 0.35); background: rgba(16, 185, 129, 0.1); }
.tag-warn { color: var(--accent-gold); border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.1); }
.tag-blue { color: var(--accent-cyan); border-color: rgba(0, 229, 255, 0.3); background: rgba(0, 229, 255, 0.08); }
.tag-mini { font-size: 0.65rem; padding: 0.05rem 0.35rem; }

.option-price {
  text-align: right;
  display: flex;
  flex-direction: column;
}

.option-price .price {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 700;
  color: #fff;
}

.option-price .price-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.legs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

@media (max-width: 800px) {
  .legs { grid-template-columns: 1fr; }
  .option-price { text-align: left; }
}

.leg-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-cyan);
}

.leg-times {
  font-size: 1.05rem;
  margin: 0.2rem 0;
}

.leg-times strong {
  color: #fff;
}

.leg-times sup {
  color: var(--accent-red);
  font-size: 0.7rem;
  font-weight: 700;
}

.leg-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.option-details {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.option-details summary {
  cursor: pointer;
  color: var(--accent-cyan);
  font-size: 0.85rem;
}

.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}

@media (max-width: 800px) {
  .details-grid { grid-template-columns: 1fr; }
}

.details-grid h4 {
  color: var(--text-main);
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.segment {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
}

.flight-number {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-main);
}

.segment-layover {
  font-size: 0.8rem;
  color: var(--accent-gold);
  padding: 0.35rem 0.6rem;
  border: 1px dashed rgba(245, 158, 11, 0.3);
  border-radius: 6px;
}

.sellers-table {
  margin-top: 0.5rem;
}

.small-note {
  font-size: 0.8rem;
  margin-top: 0.75rem;
}

.small-note a,
.btn-link {
  color: var(--accent-cyan);
}

.option-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
}

.btn-link {
  background: transparent;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.btn-link:hover {
  text-decoration: underline;
}

.btn.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn:disabled {
  opacity: 0.75;
  cursor: wait;
}

.spin {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Unpriced itineraries */
.unpriced-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.unpriced-card {
  padding: 1.2rem 1.4rem;
}

.segment-list {
  font-size: 0.85rem;
  margin-top: 0.5rem;
  color: var(--text-muted);
}

/* History Table */
.table-container {
  overflow-x: auto;
  margin-top: 0.5rem;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.history-table th {
  padding: 0.75rem 1rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.75rem;
}

.history-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.history-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-main);
}

.fare-cell {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
}

.status-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

/* Footer */
.footer {
  text-align: center;
  padding: 2.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  margin-top: 3rem;
}

/* Data-quality notes */
.fare-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: -0.4rem 0 0.8rem;
}

.level-low { color: var(--accent-green); }
.level-typical { color: var(--accent-gold); }
.level-high { color: var(--accent-red); }

.reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.reference-note {
  grid-column: 1 / -1;
  margin: 0;
}

.reference-card {
  padding: 1.1rem 1.3rem;
}

.reference-card .option-price {
  text-align: left;
  margin: 0.2rem 0;
}
