/* Icarus Dashboard — Dark Aviation Theme */

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131825;
  --bg-card: #1a2035;
  --bg-hover: #222b42;
  --border: #2a3450;
  --text-primary: #e8eaf0;
  --text-secondary: #8b93a8;
  --text-muted: #5a6380;
  --accent: #3b82f6;
  --accent-dim: #1e40af;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.header-brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.header-brand h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--accent);
}

.header-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

.header-status {
  font-size: 12px;
  color: var(--text-muted);
}

/* Stats Section */
.stats-section {
  padding: 20px 24px;
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  min-height: 300px;
}

/* Controls */
.controls-section {
  padding: 0 24px 12px;
}

.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.filter-select,
.filter-input {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
}

.filter-select:focus,
.filter-input:focus,
.search-input:focus {
  border-color: var(--accent);
}

.filter-input {
  width: 100px;
}

.search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-input {
  flex: 1;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
}

.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-dim);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Table */
.table-section {
  padding: 0 24px 20px;
}

/* Override Tabulator midnight theme for our palette */
.tabulator {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px;
  font-size: 13px !important;
}

.tabulator .tabulator-header {
  background: var(--bg-secondary) !important;
  border-bottom: 1px solid var(--border) !important;
}

.tabulator .tabulator-header .tabulator-col {
  background: transparent !important;
  border-right: 1px solid var(--border) !important;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title {
  color: var(--text-secondary) !important;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tabulator .tabulator-tableholder .tabulator-table .tabulator-row {
  background: transparent !important;
  border-bottom: 1px solid #1e2740 !important;
  cursor: pointer;
}

.tabulator .tabulator-tableholder .tabulator-table .tabulator-row:hover {
  background: var(--bg-hover) !important;
}

.tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell {
  border-right: none !important;
  color: var(--text-primary) !important;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* Detail Panel */
.detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
}

.detail-overlay.active {
  display: block;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: -440px;
  width: 420px;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: right 0.2s ease;
  overflow: hidden;
}

.detail-panel.active {
  right: 0;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.detail-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text-primary);
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 8px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #1e2740;
}

.detail-key {
  font-size: 12px;
  color: var(--text-secondary);
}

.detail-val {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

.owner-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
}

.owner-card .owner-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.owner-card .owner-meta {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-current {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.badge-historical {
  background: rgba(139, 147, 168, 0.15);
  color: var(--text-secondary);
}

/* Footer */
.footer {
  text-align: center;
  padding: 16px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 1200px) {
  .stats-cards {
    grid-template-columns: repeat(3, 1fr);
  }
  .charts-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .stats-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .filter-bar {
    flex-direction: column;
  }
  .filter-select, .filter-input {
    width: 100%;
  }
  .detail-panel {
    width: 100%;
    right: -100%;
  }
}
