/* ============================================================
   RegComply — KYC Compliance Gap Analysis
   Custom styles (layered on top of Tailwind CDN)
   ============================================================ */

/* ── Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Scrollbars ── */
.custom-scrollbar::-webkit-scrollbar { width: 4px; height: 4px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(59,130,246,0.4); }

/* ── Glass cards ── */
.glass-effect {
  background: rgba(16, 20, 28, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.dark .glass-effect {
  background: rgba(16, 20, 28, 0.55);
  border-color: rgba(255, 255, 255, 0.06);
}
html:not(.dark) .glass-effect {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 0, 0, 0.08);
}

/* ── Premium dashed upload border ── */
.premium-dashed {
  background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='16' ry='16' stroke='%233B82F644' stroke-width='2' stroke-dasharray='8%2c 12' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e");
  border-radius: 16px;
  transition: background-image 0.2s;
}
.premium-dashed.drop-active {
  background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='16' ry='16' stroke='%233B82F6AA' stroke-width='2.5' stroke-dasharray='8%2c 12' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e");
  background-color: rgba(59, 130, 246, 0.06);
}

/* ── Scanline overlay (log console) ── */
.scanline-overlay {
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%,
    rgba(0, 0, 0, 0.18) 50%
  ), linear-gradient(
    90deg,
    rgba(59, 130, 246, 0.02),
    rgba(0, 0, 0, 0),
    rgba(99, 102, 241, 0.02)
  );
  background-size: 100% 4px, 4px 100%;
  pointer-events: none;
}

/* ── Shimmer on run button ── */
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}
.shimmer-btn { position: relative; overflow: hidden; }
.shimmer-btn::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  animation: shimmer 2.4s infinite;
}

/* ── Spinner ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-small {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ── File chips ── */
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  color: #93c5fd;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  max-width: 260px;
  animation: chip-in 0.25s ease;
}
@keyframes chip-in { from { opacity:0; transform:scale(0.85); } to { opacity:1; transform:scale(1); } }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.chip-size { color: rgba(148,163,184,0.6); font-size: 11px; flex-shrink: 0; }
.chip-remove {
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: rgba(148,163,184,0.5); padding: 0; margin-left: 2px;
  transition: color 0.15s;
}
.chip-remove:hover { color: #ef4444; }

/* ── Log console lines ── */
.log-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 2px 0;
  font-size: 12.5px;
  line-height: 1.6;
  animation: log-in 0.2s ease;
}
@keyframes log-in { from { opacity:0; transform:translateX(-6px); } to { opacity:1; transform:translateX(0); } }
.log-time { color: rgba(100,116,139,0.6); flex-shrink:0; font-size: 11px; }
.log-icon { flex-shrink: 0; width: 14px; text-align: center; }
.log-msg  { flex: 1; word-break: break-word; }
.log-info  .log-icon, .log-info  .log-msg  { color: #cbd5e1; }
.log-step  .log-icon { color: #60a5fa; }
.log-step  .log-msg  {
  color: #bfdbfe; font-weight: 700; letter-spacing: 0.01em;
  text-shadow: 0 0 8px rgba(59,130,246,0.25);
}
.log-sub   .log-msg  {
  color: #94a3b8; padding-left: 22px; font-size: 12px;
  border-left: 1px solid rgba(59,130,246,0.18);
  margin-left: 6px;
}
.log-done  .log-icon { color: #34d399; }
.log-done  .log-msg  { color: #6ee7b7; font-weight: 700; }
.log-error .log-icon { color: #f87171; }
.log-error .log-msg  { color: #fca5a5; font-weight: 700; }

/* Stage divider — fires every time the bar advances to a new pipeline step */
.log-stage {
  margin: 10px 0 4px 0;
  padding-top: 6px;
  border-top: 1px dashed rgba(59,130,246,0.28);
  align-items: center;
}
.log-stage .log-time { color: rgba(100,116,139,0.55); font-size: 10px; }
.log-stage-text {
  color: #93c5fd;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 11px;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(59,130,246,0.45);
  flex: 1;
}

/* Active step label glow */
.step-label.step-label-active { color: #60a5fa; text-shadow: 0 0 6px rgba(59,130,246,0.4); }
.step-label.step-label-done   { color: #34d399; }

/* ── Stepper circles ── */
.step-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  transition: all 0.4s ease;
  position: relative;
}
.step-pending  { background: #11141c; border: 1px solid rgba(255,255,255,0.08); color: #475569; }
.step-active   { background: rgba(59,130,246,0.15); border: 1.5px solid #3b82f6; color: #60a5fa;
                 box-shadow: 0 0 14px rgba(59,130,246,0.3); }
.step-done     { background: rgba(16,185,129,0.15); border: 1.5px solid #10b981; color: #34d399; }
@keyframes step-pulse {
  0%,100% { box-shadow: 0 0 8px rgba(59,130,246,0.3); }
  50%     { box-shadow: 0 0 18px rgba(59,130,246,0.6); }
}
.step-active { animation: step-pulse 1.8s ease-in-out infinite; }

/* ── Status dots ── */
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  transition: background 0.3s;
}
.dot-green  { background: #10b981; box-shadow: 0 0 6px rgba(16,185,129,0.5); }
.dot-yellow { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,0.5); }
.dot-red    { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.5); }

/* ── Status badges ── */
.status-badge {
  font-size: 9px; font-weight: 800; letter-spacing: 0.1em;
  padding: 3px 10px; border-radius: 999px; border: 1px solid;
}
.badge-green  { background: rgba(16,185,129,0.1);  color: #34d399; border-color: rgba(16,185,129,0.25); }
.badge-yellow { background: rgba(245,158,11,0.1);  color: #fbbf24; border-color: rgba(245,158,11,0.25); }
.badge-red    { background: rgba(239,68,68,0.1);   color: #f87171; border-color: rgba(239,68,68,0.25); }

/* ── RBI doc list ── */
.rbi-doc-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; border-radius: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  font-size: 11px;
}

/* ── Pill badges ── */
.pill {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  white-space: nowrap;
}
.pill-pass    { background: rgba(16,185,129,0.12);  color: #34d399; }
.pill-partial { background: rgba(245,158,11,0.12);  color: #fbbf24; }
.pill-fail    { background: rgba(239,68,68,0.12);   color: #f87171; }
.pill-na      { background: rgba(100,116,139,0.12); color: #94a3b8; }
.pill-high    { background: rgba(239,68,68,0.12);   color: #f87171; }
.pill-medium  { background: rgba(249,115,22,0.12);  color: #fb923c; }
.pill-low     { background: rgba(245,158,11,0.12);  color: #fbbf24; }

/* ── Metric cards ── */
.metric-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-left-width: 3px;
  border-radius: 14px;
  padding: 20px;
}
.metric-label { font-size: 9px; font-weight: 700; letter-spacing: 0.12em; color: #64748b; text-transform: uppercase; margin-bottom: 8px; }
.metric-value { font-size: 32px; font-weight: 800; line-height: 1; margin-bottom: 6px; }
.metric-sub   { font-size: 11px; color: #475569; }

/* ── Score label ── */
.score-label {
  font-size: 9px; font-weight: 800; letter-spacing: 0.18em;
  padding: 4px 14px; border-radius: 999px; text-transform: uppercase;
}
.label-green  { background: rgba(16,185,129,0.12);  color: #34d399; border: 1px solid rgba(16,185,129,0.2); }
.label-yellow { background: rgba(245,158,11,0.12);  color: #fbbf24; border: 1px solid rgba(245,158,11,0.2); }
.label-red    { background: rgba(239,68,68,0.12);   color: #f87171; border: 1px solid rgba(239,68,68,0.2); }

/* ── Tab buttons ── */
.tab-btn {
  padding: 16px 28px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.2s ease;
  background: none; border-left: none; border-right: none; border-top: none;
  cursor: pointer;
}
.tab-btn.tab-active   { border-bottom-color: #3b82f6; color: #60a5fa; }
.tab-btn.tab-inactive { color: #475569; }
.tab-btn.tab-inactive:hover { color: #94a3b8; }

.tab-content { animation: fade-in 0.25s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── Gap filter buttons ── */
.gap-filter-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 8px; font-size: 11px; font-weight: 600;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  color: #64748b; cursor: pointer; transition: all 0.2s;
}
.gap-filter-btn:hover { border-color: rgba(59,130,246,0.3); color: #93c5fd; }
.gap-filter-btn.filter-active { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.3); color: #60a5fa; }
.filter-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: rgba(255,255,255,0.06); border-radius: 99px;
  font-size: 10px; font-weight: 700;
}

/* ── Gap cards ── */
.gap-card {
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.02);
  overflow: hidden;
  transition: border-color 0.2s;
}
.gap-card:hover { border-color: rgba(255,255,255,0.1); }
.sev-high   .gap-card-header { border-left: 3px solid #ef4444; }
.sev-medium .gap-card-header { border-left: 3px solid #f97316; }
.sev-low    .gap-card-header { border-left: 3px solid #f59e0b; }
.gap-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 20px; cursor: pointer; gap: 12px;
  transition: background 0.2s;
}
.gap-card-header:hover { background: rgba(255,255,255,0.02); }
.gap-card-body {
  padding: 0 20px;
  max-height: 0; overflow: hidden;
  transition: max-height 0.35s ease, padding 0.2s;
}
.gap-card.gap-open .gap-card-body { max-height: 600px; padding: 4px 20px 20px; }
.toggle-icon { transition: transform 0.3s ease; flex-shrink: 0; margin-top: 2px; }
.rbi-ref-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 8px;
  background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.2);
  color: #60a5fa; font-size: 11px; font-weight: 600; margin-bottom: 10px;
}
.recommendation-box {
  background: rgba(245,158,11,0.05); border: 1px solid rgba(245,158,11,0.15);
  border-radius: 10px; padding: 14px; margin-top: 12px;
}

/* ── Checklist items ── */
.checklist-item {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px; overflow: hidden;
  transition: border-color 0.2s;
  cursor: pointer;
}
.checklist-item:hover { border-color: rgba(255,255,255,0.1); }
.checklist-summary {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px; padding: 14px 16px;
}
.checklist-detail { padding: 0 16px; transition: padding 0.2s; }
.checklist-item.cl-open .checklist-detail { padding: 0 16px 14px; }
.clause-ref {
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  color: #60a5fa; background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.2);
  padding: 2px 8px; border-radius: 6px;
}
.detail-label { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #64748b; margin-bottom: 4px; }
.detail-text  { font-size: 13px; color: #94a3b8; line-height: 1.65; }

/* ── Toast ── */
@keyframes toast-in  { from { opacity:0; transform:translateX(40px); } to { opacity:1; transform:translateX(0); } }
@keyframes toast-out { from { opacity:1; transform:translateX(0);     } to { opacity:0; transform:translateX(40px); } }
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: 12px;
  background: #0f172a; border-left: 3px solid;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 1px 4px rgba(0,0,0,0.3);
  max-width: 360px; min-width: 260px;
  animation: toast-in 0.3s ease;
}
.toast.toast-out { animation: toast-out 0.35s ease forwards; }

/* ── Navigation status pill ── */
.nav-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ── Markdown prose (rendered report) ── */
.md-prose { font-size: 14px; line-height: 1.8; color: #94a3b8; }
.md-prose h1 {
  font-size: 22px; font-weight: 800; color: #f1f5f9;
  margin: 0 0 16px; padding-bottom: 12px;
  border-bottom: 1px solid rgba(59,130,246,0.25);
  background: linear-gradient(90deg,#60a5fa,#818cf8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.md-prose h2 {
  font-size: 17px; font-weight: 700; color: #60a5fa;
  margin: 28px 0 10px; padding-left: 12px;
  border-left: 3px solid #3b82f6;
}
.md-prose h3 { font-size: 14px; font-weight: 700; color: #e2e8f0; margin: 20px 0 8px; }
.md-prose p  { margin: 0 0 14px; }
.md-prose strong { color: #f1f5f9; font-weight: 700; }
.md-prose em { color: #c4b5fd; font-style: italic; }
.md-prose a  { color: #60a5fa; text-decoration: underline; text-underline-offset: 3px; }
.md-prose ul, .md-prose ol { margin: 0 0 14px 20px; }
.md-prose li { margin-bottom: 6px; }
.md-prose ul li::marker { color: #3b82f6; }
.md-prose blockquote {
  border-left: 3px solid #3b82f6;
  background: rgba(59,130,246,0.05); border-radius: 0 8px 8px 0;
  padding: 12px 16px; margin: 14px 0; color: #94a3b8; font-style: italic;
}
.md-prose code {
  background: rgba(59,130,246,0.1); color: #93c5fd;
  padding: 2px 7px; border-radius: 5px; font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
}
.md-prose pre {
  background: #0a0c10; border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px; padding: 16px; overflow-x: auto; margin: 14px 0;
}
.md-prose pre code { background: none; color: #93c5fd; padding: 0; }
.md-prose hr { border: none; border-top: 1px solid rgba(255,255,255,0.06); margin: 24px 0; }
.md-prose table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 13px; }
.md-prose th {
  text-align: left; padding: 10px 14px;
  background: rgba(255,255,255,0.03); color: #64748b;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.md-prose td { padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.03); color: #94a3b8; }
.md-prose tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Empty state ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px;
  padding: 60px 20px; color: #475569; font-size: 14px; text-align: center;
}

/* ── Results section entrance ── */
@keyframes results-in {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
#results-section:not(.hidden) { animation: results-in 0.5s ease; }

/* ── Mapping table rows ── */
.mapping-row td { vertical-align: top; }

/* ── Nav sidebar link active ── */
.sidebar-link-active {
  background: rgba(59,130,246,0.1);
  color: #60a5fa;
  border-left: 3px solid #3b82f6;
}

/* ── Light theme overrides ── */
html:not(.dark) body { background: #f0f4ff; color: #0f172a; }
html:not(.dark) .glass-effect { background: rgba(255,255,255,0.8); border-color: rgba(0,0,0,0.08); }
html:not(.dark) .log-line .log-time { color: rgba(100,116,139,0.8); }
html:not(.dark) .log-info .log-msg  { color: #475569; }
html:not(.dark) .log-step .log-msg  { color: #2563eb; }
html:not(.dark) .log-done .log-msg  { color: #059669; }
html:not(.dark) .log-error .log-msg { color: #dc2626; }
html:not(.dark) .step-pending { background: #f1f5f9; border-color: #cbd5e1; color: #94a3b8; }
html:not(.dark) .metric-card  { background: rgba(255,255,255,0.6); border-color: rgba(0,0,0,0.08); }
html:not(.dark) .checklist-item,
html:not(.dark) .gap-card     { background: rgba(255,255,255,0.5); border-color: rgba(0,0,0,0.08); }
html:not(.dark) .toast        { background: #ffffff; box-shadow: 0 8px 32px rgba(0,0,0,0.15); }
html:not(.dark) .md-prose     { color: #475569; }
html:not(.dark) .md-prose h1,
html:not(.dark) .md-prose h2  { color: #2563eb; -webkit-text-fill-color: unset; }
html:not(.dark) .md-prose strong { color: #0f172a; }
html:not(.dark) .md-prose pre { background: #f8faff; border-color: #e2e8f0; }
html:not(.dark) .md-prose pre code { color: #2563eb; }
html:not(.dark) .custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }

/* ── Misc ── */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.font-inter { font-family: 'Inter', sans-serif; }
.font-mono  { font-family: 'JetBrains Mono', monospace; }
