/* FraudShield - custom fintech theme on top of Bootstrap 5 */
:root {
  --ff-bg: #0b1120;
  --ff-surface: #111827;
  --ff-surface-2: #172033;
  --ff-border: #22304a;
  --ff-text: #e5e7eb;
  --ff-muted: #94a3b8;
  --ff-accent: #14b8a6;
  --ff-accent-hover: #0d9488;
  --ff-low: #22c55e;
  --ff-medium: #f59e0b;
  --ff-high: #ef4444;
  --ff-radius: 14px;
  --bs-body-bg: var(--ff-bg);
  --bs-body-color: var(--ff-text);
  --bs-border-color: var(--ff-border);
  --bs-secondary-color: var(--ff-muted);
}

body {
  background: var(--ff-bg);
  color: var(--ff-text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 0.925rem;
}

.mono, code { font-family: "JetBrains Mono", ui-monospace, monospace; }
code { color: #5eead4; font-size: 0.85em; }

.text-low { color: var(--ff-low) !important; }
.text-medium { color: var(--ff-medium) !important; }
.text-high { color: var(--ff-high) !important; }
.text-secondary { color: var(--ff-muted) !important; }
.bg-accent { background-color: var(--ff-accent) !important; }
.link-accent { color: var(--ff-accent); text-decoration: none; }
.link-accent:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.sidebar { --bs-offcanvas-width: 264px; --bs-offcanvas-bg: var(--ff-surface); }
@media (min-width: 992px) {
  .sidebar-col {
    width: 264px;
    flex-shrink: 0;
    background: var(--ff-surface);
    border-right: 1px solid var(--ff-border);
    position: sticky;
    top: 0;
    height: 100vh;
  }
  .sidebar, .sidebar-body { height: 100%; }
}
.sidebar-body { padding: 1.25rem 1rem; gap: 1.5rem; }

.brand {
  display: flex; align-items: center; gap: 0.75rem;
  color: var(--ff-text); text-decoration: none; font-weight: 700; font-size: 1.05rem;
}
.brand small { display: block; font-weight: 500; font-size: 0.72rem; color: var(--ff-muted); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  display: inline-grid; place-items: center; flex-shrink: 0;
  background: rgba(20, 184, 166, 0.15); color: var(--ff-accent); font-size: 1.15rem;
}
.brand-mark.lg { width: 52px; height: 52px; font-size: 1.5rem; }

.sidebar .nav-link {
  color: var(--ff-muted); border-radius: 10px; padding: 0.6rem 0.8rem;
  display: flex; align-items: center; gap: 0.7rem; font-weight: 500;
}
.sidebar .nav-link:hover { color: var(--ff-text); background: var(--ff-surface-2); }
.sidebar .nav-link.active { color: #fff; background: rgba(20, 184, 166, 0.16); box-shadow: inset 3px 0 0 var(--ff-accent); }
.sidebar .nav-link:focus-visible { outline: 2px solid var(--ff-accent); outline-offset: 1px; }

.sidebar-footer { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--ff-border); }
.model-status { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.85rem; margin-bottom: 0.35rem; }
.model-status .dot { width: 8px; height: 8px; border-radius: 50%; }
.model-status.ready .dot { background: var(--ff-low); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
.model-status.missing .dot { background: var(--ff-high); }

.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--ff-border);
  background: rgba(11, 17, 32, 0.85); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.page-title { font-size: 1.35rem; font-weight: 700; margin: 0; }
.page-subtitle { color: var(--ff-muted); margin: 0.15rem 0 0; font-size: 0.85rem; }
.content { padding: 1.5rem; flex: 1; }
.app-footer { padding: 1rem 1.5rem; color: var(--ff-muted); font-size: 0.78rem; border-top: 1px solid var(--ff-border); }

@media (max-width: 575.98px) {
  .topbar, .content { padding-left: 1rem; padding-right: 1rem; }
}

/* ---------- Buttons ---------- */
.btn-accent { background: var(--ff-accent); color: #04211e; font-weight: 600; border: none; }
.btn-accent:hover, .btn-accent:focus-visible { background: var(--ff-accent-hover); color: #fff; }
.btn-accent:disabled { background: var(--ff-surface-2); color: var(--ff-muted); }
.btn-icon { color: var(--ff-text); font-size: 1.4rem; padding: 0.15rem 0.4rem; }

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--ff-surface); border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius); padding: 1.25rem;
}
.panel-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 1rem; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }

.stat-card {
  background: var(--ff-surface); border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius); padding: 1rem 1.1rem;
  display: flex; flex-direction: column; gap: 0.35rem; height: 100%;
}
.stat-label { color: var(--ff-muted); font-size: 0.8rem; font-weight: 500; display: flex; gap: 0.4rem; align-items: center; }
.stat-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.chart-box { position: relative; height: 240px; }

.empty-state { text-align: center; padding: 2.5rem 1rem; }
.empty-state > i { font-size: 2.25rem; color: var(--ff-accent); display: block; margin-bottom: 0.75rem; }

/* ---------- Forms ---------- */
.form-control, .form-select, .input-group-text {
  background-color: var(--ff-bg); border-color: var(--ff-border); color: var(--ff-text);
}
.form-control:focus, .form-select:focus {
  background-color: var(--ff-bg); color: var(--ff-text);
  border-color: var(--ff-accent); box-shadow: 0 0 0 0.2rem rgba(20, 184, 166, 0.2);
}
.form-label { font-weight: 500; font-size: 0.85rem; color: #cbd5e1; }

/* ---------- Tables ---------- */
.table-ff {
  --bs-table-bg: transparent; --bs-table-color: var(--ff-text);
  --bs-table-border-color: var(--ff-border); --bs-table-hover-bg: var(--ff-surface-2);
  font-size: 0.85rem;
}
.table-ff thead th { color: var(--ff-muted); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.table-ff td { white-space: nowrap; }
.table-ff tbody tr.row-high { box-shadow: inset 3px 0 0 var(--ff-high); background: rgba(239, 68, 68, 0.06); }
.table-ff tbody tr.row-medium { box-shadow: inset 3px 0 0 var(--ff-medium); background: rgba(245, 158, 11, 0.05); }
.table-ff tbody tr.row-low { box-shadow: inset 3px 0 0 var(--ff-low); }

.live-table { max-height: 520px; overflow-y: auto; }
.row-enter { animation: rowIn 0.6s ease-out; }
@keyframes rowIn { from { opacity: 0; transform: translateY(-6px); background: rgba(20, 184, 166, 0.18); } to { opacity: 1; transform: none; } }

/* ---------- Badges ---------- */
.badge-risk, .badge-pred {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600;
}
.risk-low { background: rgba(34, 197, 94, 0.14); color: #4ade80; }
.risk-medium { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.risk-high { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.pred-fraud { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.pred-legit { background: rgba(34, 197, 94, 0.14); color: #4ade80; }

/* ---------- Analyze result ---------- */
.result-panel { position: sticky; top: 96px; }
.verdict { border-radius: 12px; padding: 1.25rem; margin-bottom: 1rem; border: 1px solid; }
.verdict.low { background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.35); }
.verdict.medium { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.35); }
.verdict.high { background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.4); }
.verdict-title { font-size: 1.5rem; font-weight: 700; margin: 0.25rem 0; }
.prob-bar { height: 10px; border-radius: 999px; background: var(--ff-bg); overflow: hidden; position: relative; }
.prob-bar > span { display: block; height: 100%; border-radius: 999px; transition: width 0.6s ease; }
.prob-scale { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--ff-muted); margin-top: 0.3rem; }
.reason-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.reason-list li { display: flex; gap: 0.6rem; align-items: flex-start; background: var(--ff-bg); border: 1px solid var(--ff-border); border-radius: 10px; padding: 0.6rem 0.75rem; }
.reason-list i { color: var(--ff-medium); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; font-size: 0.82rem; margin: 0; }
.kv dt { color: var(--ff-muted); font-weight: 500; }
.kv dd { margin: 0; text-align: right; }

/* ---------- Live monitor ---------- */
.live-indicator { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; padding: 0.35rem 0.8rem; border-radius: 999px; background: var(--ff-surface-2); }
.live-indicator .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ff-muted); }
.live-indicator.running .dot { background: var(--ff-high); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); } 70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }

/* ---------- Alerts ---------- */
.alert-card { background: var(--ff-bg); border: 1px solid rgba(239, 68, 68, 0.35); border-radius: 12px; padding: 1rem; height: 100%; }
.alert-card .amount { font-size: 1.25rem; font-weight: 700; }

/* ---------- Performance ---------- */
.progress-thin { height: 6px; background: var(--ff-bg); }
.cm-grid { display: grid; gap: 0.5rem; }
.cm-row { display: grid; grid-template-columns: 1fr 1.3fr 1.3fr; gap: 0.5rem; align-items: stretch; }
.cm-head { color: var(--ff-muted); font-size: 0.78rem; font-weight: 500; display: flex; align-items: center; justify-content: center; text-align: center; }
.cm-cell { border-radius: 10px; padding: 0.9rem 0.5rem; text-align: center; display: flex; flex-direction: column; gap: 0.2rem; }
.cm-cell strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.cm-cell small { color: var(--ff-muted); font-size: 0.72rem; }
.cm-cell.good { background: rgba(34, 197, 94, 0.12); }
.cm-cell.warn { background: rgba(245, 158, 11, 0.12); }
.cm-cell.bad { background: rgba(239, 68, 68, 0.14); }

.feature-list li { display: grid; grid-template-columns: minmax(120px, 1.2fr) 2fr 52px; gap: 0.75rem; align-items: center; padding: 0.35rem 0; font-size: 0.82rem; }
.feature-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feature-bar { height: 8px; background: var(--ff-bg); border-radius: 999px; overflow: hidden; }
.feature-bar > span { display: block; height: 100%; background: var(--ff-accent); border-radius: 999px; }
.feature-val { text-align: right; color: var(--ff-muted); font-variant-numeric: tabular-nums; }

/* ---------- About ---------- */
.steps { padding-left: 1.2rem; margin: 0; color: var(--ff-muted); display: grid; gap: 0.5rem; }
.steps strong { color: var(--ff-text); }
.arch { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.arch-box { flex: 1 1 140px; background: var(--ff-bg); border: 1px solid var(--ff-border); border-radius: 12px; padding: 1rem; display: flex; flex-direction: column; gap: 0.25rem; }
.arch-box i { color: var(--ff-accent); font-size: 1.25rem; }
.arch-box span { color: var(--ff-muted); font-size: 0.78rem; }
.arch-arrow { color: var(--ff-muted); }
@media (max-width: 575.98px) { .arch-arrow { display: none; } }
.tech-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; color: var(--ff-muted); font-size: 0.85rem; }
.tech-list span { display: inline-block; min-width: 120px; color: var(--ff-text); font-weight: 600; }
.disclaimer { border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.06); }
.disclaimer .panel-title { color: #fbbf24; }
