/* ═══════════════════════════════════════════════════════
   LLMQ Dashboard — Styles
   Dev-tool aesthetic · Dark mode default
   ═══════════════════════════════════════════════════════ */

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ── Sidebar ── */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: #0d1117;
  border-right: 1px solid rgba(99,102,241,0.08);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  z-index: 40;
}

@media (max-width: 1023px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 35;
  }
}

.sidebar-header {
  padding: 20px 16px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(99,102,241,0.06);
}

.logo-container {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1 0%, #22d3ee 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(99,102,241,0.25);
  flex-shrink: 0;
}

.logo-img {
  width: 22px;
  height: 22px;
  filter: brightness(0) invert(1);
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  text-decoration: none;
  transition: all 0.15s ease;
  position: relative;
}

.nav-item:hover {
  color: #e2e8f0;
  background: rgba(99,102,241,0.06);
}

.nav-item.active {
  color: #e2e8f0;
  background: rgba(99,102,241,0.12);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #6366f1, #22d3ee);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(99,102,241,0.06);
}

/* ── Top Bar ── */
.topbar {
  background: rgba(17,24,39,0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(99,102,241,0.06);
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
}

.badge-provider {
  background: rgba(99,102,241,0.1);
  color: #a5b4fc;
  border: 1px solid rgba(99,102,241,0.2);
}

.badge-model {
  background: rgba(34,211,238,0.08);
  color: #67e8f9;
  border: 1px solid rgba(34,211,238,0.15);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Gate Indicator ── */
.gate-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.gate-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.gate-pass {
  background: rgba(34,197,94,0.1);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.2);
}
.gate-pass .gate-dot {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34,197,94,0.5);
}

.gate-fail {
  background: rgba(239,68,68,0.1);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.2);
}
.gate-fail .gate-dot {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239,68,68,0.5);
}

.gate-unknown {
  background: rgba(148,163,184,0.06);
  color: #64748b;
  border: 1px solid rgba(148,163,184,0.1);
}
.gate-unknown .gate-dot {
  background: #64748b;
}

/* ── CI Banner ── */
.ci-banner {
  background: linear-gradient(90deg, rgba(245,158,11,0.08) 0%, rgba(245,158,11,0.02) 100%);
  border-bottom: 1px solid rgba(245,158,11,0.15);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #fbbf24;
}

/* ── Pages ── */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.25s ease; }

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

/* ── Cards ── */
.card {
  background: rgba(17,24,39,0.6);
  border: 1px solid rgba(99,102,241,0.06);
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.2s ease;
}
.card:hover { border-color: rgba(99,102,241,0.12); }

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Metric Cards ── */
.metric-card {
  background: rgba(17,24,39,0.7);
  border: 1px solid rgba(99,102,241,0.06);
  border-radius: 12px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.3), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.metric-card:hover { border-color: rgba(99,102,241,0.15); }
.metric-card:hover::before { opacity: 1; }

.metric-card-accent {
  background: linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(17,24,39,0.7) 100%);
}

.metric-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.metric-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.metric-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 10px;
  font-family: 'JetBrains Mono', monospace;
}

.metric-trend {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
}

.metric-bar {
  height: 3px;
  background: rgba(99,102,241,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.metric-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

/* ── Gauge ── */
.gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 20px 0 10px;
}

.gauge-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 36px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  background: linear-gradient(135deg, #818cf8, #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Chart Container ── */
.chart-container {
  position: relative;
  height: 240px;
}

/* ── Filter Controls ── */
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-label {
  font-size: 10px;
  color: #64748b;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select {
  background: rgba(30,41,59,0.8);
  border: 1px solid rgba(99,102,241,0.1);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  color: #cbd5e1;
  min-width: 140px;
  transition: border-color 0.15s;
  appearance: auto;
}

.filter-select:focus {
  outline: none;
  border-color: rgba(99,102,241,0.4);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  box-shadow: 0 0 12px rgba(99,102,241,0.2);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #818cf8, #6366f1);
  box-shadow: 0 0 20px rgba(99,102,241,0.3);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #059669, #047857);
  color: white;
  box-shadow: 0 0 12px rgba(5,150,105,0.2);
}
.btn-success:hover {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 0 20px rgba(5,150,105,0.3);
  transform: translateY(-1px);
}

/* ── Tables ── */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(99,102,241,0.08);
  white-space: nowrap;
  user-select: none;
}

.data-table thead th.sortable {
  cursor: pointer;
  transition: color 0.15s;
}
.data-table thead th.sortable:hover { color: #94a3b8; }
.data-table thead th.sortable.sorted { color: #818cf8; }

.sort-icon {
  font-size: 10px;
  opacity: 0.4;
  margin-left: 2px;
}
.sorted .sort-icon { opacity: 1; }

.data-table tbody tr {
  border-bottom: 1px solid rgba(99,102,241,0.04);
  transition: background 0.1s;
}

.data-table tbody tr:hover {
  background: rgba(99,102,241,0.04);
}

.data-table tbody tr.clickable { cursor: pointer; }

.data-table tbody td {
  padding: 10px 12px;
  color: #cbd5e1;
  white-space: nowrap;
}

/* ── Gate Pill ── */
.gate-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.gate-pill-pass {
  background: rgba(34,197,94,0.12);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.2);
}

.gate-pill-fail {
  background: rgba(239,68,68,0.12);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.2);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: #111827;
  border: 1px solid rgba(99,102,241,0.12);
  border-radius: 16px;
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0,0,0,0.5), 0 0 30px rgba(99,102,241,0.1);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(99,102,241,0.08);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.15s;
}
.modal-close:hover { background: rgba(99,102,241,0.1); color: #e2e8f0; }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(85vh - 70px);
}

/* ── Settings ── */
.setting-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-label {
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
}

.setting-input {
  background: rgba(30,41,59,0.8);
  border: 1px solid rgba(99,102,241,0.1);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  color: #e2e8f0;
  transition: border-color 0.15s;
  width: 100%;
}

.setting-input:focus {
  outline: none;
  border-color: rgba(99,102,241,0.4);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  max-width: 360px;
}

.toast-info {
  background: rgba(30,41,59,0.95);
  color: #e2e8f0;
  border: 1px solid rgba(99,102,241,0.2);
}

.toast-pass {
  background: rgba(5,46,22,0.95);
  color: #86efac;
  border: 1px solid rgba(34,197,94,0.3);
}

.toast-fail {
  background: rgba(69,10,10,0.95);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.3);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateX(20px); }
}

/* ── Test Case Cards ── */
.test-case-card {
  background: rgba(30,41,59,0.5);
  border: 1px solid rgba(99,102,241,0.06);
  border-radius: 10px;
  padding: 12px 16px;
  transition: border-color 0.15s;
}
.test-case-card:hover { border-color: rgba(99,102,241,0.15); }

.test-case-card.failed {
  border-color: rgba(239,68,68,0.15);
  background: rgba(239,68,68,0.03);
}

.test-case-header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}

.test-case-body {
  display: none;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid rgba(99,102,241,0.06);
}

.test-case-card.open .test-case-body { display: block; }

.side-by-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.side-by-side-panel {
  background: rgba(15,17,32,0.6);
  border: 1px solid rgba(99,102,241,0.06);
  border-radius: 8px;
  padding: 12px;
}

.side-by-side-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

/* ── Live Job Card ── */
.live-job {
  background: rgba(30,41,59,0.5);
  border: 1px solid rgba(99,102,241,0.08);
  border-radius: 10px;
  padding: 14px 16px;
}

.live-job-progress {
  height: 4px;
  background: rgba(99,102,241,0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 10px;
}

.live-job-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #22d3ee);
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .metric-value { font-size: 22px; }
  .side-by-side { grid-template-columns: 1fr; }
}

/* ── Skeleton Loading ── */
.skeleton {
  background: linear-gradient(90deg, rgba(30,41,59,0.5) 25%, rgba(51,65,85,0.5) 50%, rgba(30,41,59,0.5) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── Radar chart legend ── */
.radar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  justify-content: center;
}

.radar-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #94a3b8;
}

.radar-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
