/* ============================================================
   Sentry-AI — Frontend Styles (dark theme, v3)
   ============================================================ */

/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  background: #080c18;
  color: #f1f5f9;
  min-width: 1024px;
}

/* ── Utility ──────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── App shell ────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  height: 52px;
  background: #0d1128;
  border-bottom: 1px solid #1d2340;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo-img {
  height: 28px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
}
.btn-contact {
  background: #7c3aed;
  color: #ffffff;
  text-decoration: none;
  padding: 7px 20px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: background 0.12s;
  white-space: nowrap;
}
.btn-contact:hover { background: #6d28d9; }

/* ── Main layout ──────────────────────────────────────────── */
.layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   LEFT PANEL
   ═══════════════════════════════════════════════════════════ */
.left-panel {
  width: 420px;
  flex-shrink: 0;
  background: #0d1128;
  border-right: 1px solid #1d2340;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Column tab headers ───────────────────────────────────── */
.col-headers {
  display: flex;
  height: 36px;
  border-bottom: 1px solid #1d2340;
  flex-shrink: 0;
}
.col-header {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}
.col-header.col-images {
  background: #1e2a3e;
  color: #60a5fa;
  border-right: 1px solid #1d2340;
}
.col-header.col-videos {
  background: #1e1a2e;
  color: #a78bfa;
}
.col-icon { width: 12px; height: 12px; flex-shrink: 0; }

/* ── Media columns ────────────────────────────────────────── */
.media-columns {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.media-col {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.media-col:first-child { border-right: 1px solid #1d2340; }
.media-col::-webkit-scrollbar { width: 4px; }
.media-col::-webkit-scrollbar-track { background: transparent; }
.media-col::-webkit-scrollbar-thumb { background: #1d2340; border-radius: 2px; }

/* ── Thumbnail card ───────────────────────────────────────── */
.thumb-card {
  height: 120px;
  border: 1px solid #1d2340;
  border-radius: 7px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.12s;
  flex-shrink: 0;
}
.thumb-card:hover    { border-color: #475569; }
.thumb-card.selected { border: 2px solid #3b82f6; }

.thumb-img-fill {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Upload section ───────────────────────────────────────── */
.upload-section {
  padding: 10px 12px 8px;
  border-top: 1px solid #1d2340;
  flex-shrink: 0;
}
.upload-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #475569;
  margin-bottom: 8px;
}

.drop-zone {
  border: 1.5px dashed #1d2340;
  border-radius: 6px;
  padding: 11px 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.06);
}
.drop-icon {
  width: 20px;
  height: 20px;
  color: #475569;
  margin-bottom: 2px;
}
.drop-text { font-size: 11px; color: #94a3b8; font-weight: 500; }
.drop-hint { font-size: 9px; color: #475569; }

.upload-btns {
  display: flex;
  gap: 6px;
}
.btn-upload {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #1d2340;
  border-radius: 5px;
  background: #0a0e1f;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  white-space: nowrap;
}
.btn-upload:hover { border-color: #3b82f6; color: #60a5fa; background: #1e2a3e; }
.btn-icon { width: 12px; height: 12px; flex-shrink: 0; }

/* ── Inline confidence control (run-row) ─────────────────── */
.run-conf {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}
.run-conf-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.run-conf-label {
  font-size: 10px;
  font-weight: 500;
  color: #475569;
  white-space: nowrap;
}
.run-conf-val {
  font-size: 11px;
  font-weight: 700;
  color: #60a5fa;
  font-variant-numeric: tabular-nums;
  min-width: 28px;
  text-align: right;
}

/* Confidence slider — gradient track + teardrop thumb */
input[type=range].run-conf-slider {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  width: 160px;
  cursor: pointer;
  outline: none;
}
input[type=range].run-conf-slider::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(to right, #ef4444, #f97316, #eab308, #22c55e);
  border: none;
}
input[type=range].run-conf-slider::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(to right, #ef4444, #f97316, #eab308, #22c55e);
  border: none;
}
input[type=range].run-conf-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: #080c18;
  border: 2px solid #475569;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  margin-top: -3px;
  cursor: pointer;
}
input[type=range].run-conf-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #080c18;
  border: 2px solid #475569;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════
   RIGHT PANEL
   ═══════════════════════════════════════════════════════════ */
.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 14px;
  gap: 10px;
  min-width: 0;
}
.right-panel::-webkit-scrollbar { width: 5px; }
.right-panel::-webkit-scrollbar-thumb { background: #1d2340; border-radius: 3px; }

/* ── Card base ────────────────────────────────────────────── */
.card {
  background: #0d1128;
  border: 1px solid #1d2340;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.output-card { display: flex; flex-direction: column; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: #0a0e1f;
  border-bottom: 1px solid #1d2340;
  flex-shrink: 0;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #f1f5f9;
}
.card-icon { width: 14px; height: 14px; flex-shrink: 0; color: #94a3b8; }
.card-meta { font-size: 11px; color: #475569; }

/* ── Preview body ─────────────────────────────────────────── */
.preview-body {
  position: relative;
  background: #0a0e1f;
  height: 220px;
  overflow: hidden;
}
.preview-ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #334155;
  font-size: 12px;
}
.preview-ph-icon { width: 38px; height: 38px; }

.preview-media {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-media img,
.preview-media video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* Overlay pills at bottom corners */
.preview-tag {
  position: absolute;
  bottom: 10px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid #1d2340;
  color: #94a3b8;
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 4px;
  z-index: 2;
  pointer-events: none;
  white-space: nowrap;
}
.preview-tag-l { left: 10px; }
.preview-tag-r { right: 10px; }

/* ── Run row ──────────────────────────────────────────────── */
.run-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
@keyframes pulseRing {
  0%   { box-shadow: 0 0 0 0   rgba(37, 99, 235, 0.7); }
  70%  { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0   rgba(37, 99, 235, 0); }
}
.btn-run-ready {
  animation: pulseRing 1.6s ease-out infinite;
}

.btn-run {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: background 0.12s, opacity 0.12s;
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1;
}
.btn-run:hover:not(:disabled) { background: #1d4ed8; }
.btn-run:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-run-icon { width: 15px; height: 15px; flex-shrink: 0; }
.run-hint { font-size: 11.5px; color: #334155; }

/* Spinner inside btn-run while analyzing */
.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.55s linear infinite;
  flex-shrink: 0;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Output body ──────────────────────────────────────────── */
.output-body {
  background: #080c18;
  min-height: 200px;
  max-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.output-body img,
.output-body canvas,
.output-body video {
  max-height: 420px;
  max-width: 100%;
  object-fit: contain;
  display: block;
}
.output-empty {
  color: #334155;
  font-size: 12px;
  text-align: center;
  padding: 28px;
}
.output-error { color: #ef4444 !important; }
.output-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  color: #475569;
  font-size: 12px;
}
.output-loading .spinner {
  width: 20px;
  height: 20px;
  border-color: #1d2340;
  border-top-color: #94a3b8;
}

/* ── Stats bar ────────────────────────────────────────────── */
.stats-bar {
  display: flex;
  align-items: stretch;
  border-top: 1px solid #1d2340;
  min-height: 64px;
  flex-shrink: 0;
}
.stat-item {
  flex: 1;
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}
.stat-lbl {
  font-size: 9px;
  color: #475569;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.stat-val {
  font-size: 17px;
  font-weight: 700;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}
.stat-dash { color: #1d2340; }
.stat-sep {
  width: 1px;
  background: #1d2340;
  flex-shrink: 0;
  align-self: stretch;
}

/* Detection yes/no */
.det-val-yes { color: #ef4444; }
.det-val-no  { color: #22c55e; }
.det-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-red   { background: #ef4444; }
.dot-green { background: #22c55e; }

/* Confidence mini-bar */
.conf-bar-wrap { margin-top: 3px; }
.conf-bar-track {
  height: 3px;
  background: #1d2340;
  border-radius: 2px;
  overflow: hidden;
  width: 100%;
  max-width: 80px;
}
.conf-bar-fill {
  height: 100%;
  background: #ef4444;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ── Tab bar ──────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 14px;
  padding: 12px 14px;
  flex-shrink: 0;
  background: #080c18;
  border-bottom: 1px solid #1d2340;
}
.tab-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 12px;
  background: #0d1128;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.tab-card:hover {
  border-color: rgba(255, 255, 255, .18);
}
.tab-weapon-active {
  border-color: rgba(242, 91, 91, .55) !important;
  background: rgba(242, 91, 91, .07) !important;
}
.tab-aggression-active {
  border-color: rgba(249, 149, 67, .55) !important;
  background: rgba(249, 149, 67, .07) !important;
}
.tab-icon { flex-shrink: 0; }
.tab-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tab-title {
  font-size: 15px;
  font-weight: 500;
  color: #f1f5f9;
  line-height: 1.2;
}
.tab-sub {
  font-size: 12px;
  color: #475569;
  line-height: 1.2;
}

/* ── Tab panels ───────────────────────────────────────────── */
.tab-panel {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── Responsive floor ─────────────────────────────────────── */
@media (max-width: 1100px) {
  .left-panel { width: 300px; }
}
