/* ==========================================================================
   SkyPulse — type, color, layout
   ========================================================================== */

:root {
  --font-sans: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --font-display: "Syne", "Plus Jakarta Sans", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --bg: #0a0e14;
  --bg-elevated: #111820;
  --surface: #161d28;
  --surface-2: #1c2533;
  --border: rgba(238, 232, 220, 0.1);
  --border-strong: rgba(238, 232, 220, 0.2);

  --text: #f7f3ea;
  --text-muted: #b4bcc8;
  --text-dim: #8a93a3;

  --accent: #3ee0c5;
  --accent-hover: #2bc4ab;
  --sky: #7eb6ff;
  --amber: #e8b86d;
  --rose: #ef6b7b;
  --thy: #f07178;
  --ajet: #7eb6ff;
  --pegasus: #e8b86d;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

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

html {
  color-scheme: dark;
}

body.dark-theme {
  font-family: var(--font-sans);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(62, 224, 197, 0.08), transparent 50%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(126, 182, 255, 0.08), transparent 45%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand-name {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

code, .flight-no, .data-table code {
  font-family: var(--font-mono);
  font-size: 0.82em;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  isolation: isolate;
  background: rgba(10, 14, 20, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 1.05rem;
}

.brand-name {
  font-weight: 800;
  font-size: 1.2rem;
  display: block;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
}

.status-pill.green { color: var(--accent); }
.status-pill.blue { color: var(--sky); }

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(62, 224, 197, 0.5);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(62, 224, 197, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(62, 224, 197, 0); }
  100% { box-shadow: 0 0 0 0 rgba(62, 224, 197, 0); }
}

/* ==========================================================================
   Page layout
   ========================================================================== */
.dashboard-container {
  max-width: 1120px;
  margin: 2rem auto 0;
  padding: 0 1.5rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.page-intro h1 {
  font-size: clamp(1.85rem, 3.5vw, 2.6rem);
  font-weight: 800;
  line-height: 1.12;
  max-width: 18ch;
  margin: 0.35rem 0 0.7rem;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.lede {
  max-width: 52ch;
  color: var(--text-muted);
  font-size: 1rem;
}

.section-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-margin-top: 5.5rem;
}

.section-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

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

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.45rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.card-details {
  min-width: 0;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.card-icon.cyan { background: rgba(126, 182, 255, 0.12); color: var(--sky); }
.card-icon.emerald { background: rgba(62, 224, 197, 0.12); color: var(--accent); }
.card-icon.amber { background: rgba(232, 184, 109, 0.12); color: var(--amber); }
.card-icon.indigo { background: rgba(126, 182, 255, 0.1); color: var(--sky); }

.metric-title {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.metric-value {
  font-family: var(--font-sans);
  font-size: 1.55rem;
  font-weight: 800;
  display: block;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  letter-spacing: -0.02em;
}

.metric-value.text-sm {
  font-size: 1.15rem;
  letter-spacing: 0;
  font-weight: 700;
}

.metric-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ==========================================================================
   Buttons & inputs
   ========================================================================== */
.btn {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.62rem 1.1rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: background 0.15s ease, transform 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--text);
  color: #111820;
}
.btn-primary:hover { background: #fff; }

.btn-emerald {
  background: var(--accent);
  color: #06241e;
}
.btn-emerald:hover { background: var(--accent-hover); }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-danger {
  background: rgba(239, 107, 123, 0.12);
  color: var(--rose);
  border: 1px solid rgba(239, 107, 123, 0.28);
}
.btn-danger:hover { background: rgba(239, 107, 123, 0.2); }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.78rem; }
.btn-full { width: 100%; }

.input-select,
.input-text {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  outline: none;
}

.input-select option { background: var(--surface); }

.input-select:focus,
.input-text:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(62, 224, 197, 0.15);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.form-group label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.passenger-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.passenger-fields.has-other {
  grid-template-columns: 1fr 5.5rem;
}

.search-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr 1fr;
  gap: 0.85rem;
  align-items: end;
}

.search-row-dates {
  grid-template-columns: 1fr 1fr auto;
}

.swap-airports {
  width: 42px;
  height: 42px;
  margin-bottom: 1px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
}
.swap-airports:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.search-box-card { padding: 1.35rem; }

/* ==========================================================================
   Search results — boarding-pass cards
   ========================================================================== */
.search-results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
  margin-top: 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.search-meta {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.search-leg-title {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 0.2rem;
}

.search-flight-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-flight-card.best-deal {
  border-color: rgba(62, 224, 197, 0.55);
  background: linear-gradient(180deg, rgba(62, 224, 197, 0.1), var(--bg-elevated));
}

.fare-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.flight-no {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.fare-route {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.85rem;
  padding: 0.15rem 0;
}

.fare-endpoint {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.fare-endpoint.arr { text-align: right; }

.fare-time {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text);
}

.fare-airport {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  font-weight: 600;
}

.fare-line {
  height: 2px;
  width: 2.4rem;
  background: var(--border-strong);
  position: relative;
  border-radius: 999px;
}
.fare-line::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-elevated);
}

.fare-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.85rem;
  padding-top: 0.15rem;
}

.fare-amount {
  font-family: var(--font-sans);
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--accent);
  display: block;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.fare-currency {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-top: 0.2rem;
  display: block;
}

.tag-airline {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
}

.tag-airline.thy { color: #ffb0b5; background: rgba(240, 113, 120, 0.2); }
.tag-airline.ajet { color: #c4dcff; background: rgba(126, 182, 255, 0.2); }
.tag-airline.pegasus { color: #f6d7a4; background: rgba(232, 184, 109, 0.2); }

.tag-source {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-muted);
  text-align: right;
  max-width: 48%;
  line-height: 1.35;
}

/* ==========================================================================
   Alerts
   ========================================================================== */
.alerts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.alert-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.alert-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.85rem;
}

.route-badge {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}

.route-badge i { color: var(--sky); font-size: 0.9rem; }

.price-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.7rem;
}

.pill {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  white-space: normal;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  border: 1px solid transparent;
}

.pill-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.85;
}

.pill-value {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: inherit;
}

.pill.target {
  background: rgba(126, 182, 255, 0.16);
  border-color: rgba(126, 182, 255, 0.28);
  color: #d7e8ff;
}
.pill.current {
  background: rgba(62, 224, 197, 0.16);
  border-color: rgba(62, 224, 197, 0.3);
  color: #c5f8ed;
}

.airline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.alert-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.alert-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.empty-state i {
  font-size: 1.6rem;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.empty-state h3 {
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 1.15rem;
}

/* ==========================================================================
   Table
   ========================================================================== */
.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }

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

.data-table th {
  padding: 0.95rem 1.15rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}

.data-table td {
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table .price-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  font-size: 0.95rem;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

/* ==========================================================================
   Integrations
   ========================================================================== */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.integration-card h3 {
  font-size: 1.15rem;
  margin: 0.7rem 0 0.35rem;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.card-badge.telegram { background: rgba(56, 189, 248, 0.12); color: #38bdf8; }
.card-badge.discord { background: rgba(129, 140, 248, 0.12); color: #a5b4fc; }
.card-badge.slack { background: rgba(74, 21, 75, 0.2); color: #e8b4e8; }

.integrations-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.step-list {
  margin-top: 0.9rem;
  padding-left: 1.15rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.step-list li + li { margin-top: 0.4rem; }

.step-list code,
.integration-card code {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: var(--text);
}

/* ==========================================================================
   Modal & toast
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, 0.72);
  backdrop-filter: blur(10px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-card.modal-lg { max-width: 760px; }

.modal-header {
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 { font-size: 1.2rem; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
}

.checkbox-label {
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-weight: 500;
}

.chart-wrapper {
  position: relative;
  height: 340px;
  width: 100%;
}

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 0.8rem 1.05rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: slideIn 0.28s ease;
}

.toast.success { border-color: rgba(62, 224, 197, 0.4); }
.toast.error { border-color: rgba(239, 107, 123, 0.45); }

@keyframes slideIn {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.5rem;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.92rem; }
.text-center { text-align: center; }
.text-danger { color: var(--rose); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 960px) {
  .metrics-grid,
  .search-results-grid,
  .alerts-grid,
  .grid-2col,
  .integrations-grid {
    grid-template-columns: 1fr;
  }

  .search-row,
  .search-row-dates {
    grid-template-columns: 1fr 1fr;
  }

  .swap-airports {
    display: none;
  }

  .btn-group-search {
    grid-column: 1 / -1;
  }

  .status-pill { display: none; }
}

@media (max-width: 640px) {
  .navbar { padding: 0.75rem 1rem; }
  .dashboard-container { padding: 0 1rem 4rem; margin-top: 1.4rem; }
  .search-form,
  .search-row,
  .search-row-dates { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .flex-between { flex-direction: column; align-items: stretch; }
  .page-intro h1 { max-width: none; }
}
