/* ============================================================
   SentinelQA — Enterprise Banking Call Quality Platform
   Professional UI inspired by ServiceNow / PowerBI aesthetics
   ============================================================ */

:root {
  --sidebar-width:    240px;
  --sidebar-bg:       #0f1923;
  --sidebar-active:   #1a56db;
  --sidebar-hover:    rgba(255,255,255,0.07);
  --topbar-height:    60px;
  --bg-page:          #f0f2f5;
  --bg-card:          #ffffff;
  --border-color:     #e5e7eb;
  --text-primary:     #111827;
  --text-muted:       #6b7280;
  --radius-card:      10px;
  --shadow-card:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover:     0 4px 12px rgba(0,0,0,0.1);
  --color-primary:    #1a56db;
  --color-success:    #057a55;
  --color-warning:    #b45309;
  --color-danger:     #dc2626;
  --color-info:       #0891b2;
  --color-purple:     #7c3aed;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-icon {
  width: 36px; height: 36px;
  background: var(--color-primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #fff; flex-shrink: 0;
}
.brand-name { font-weight: 700; color: #fff; font-size: 0.95rem; line-height: 1.2; }
.brand-sub  { color: rgba(255,255,255,0.45); font-size: 0.72rem; }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-section-label {
  color: rgba(255,255,255,0.35);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 8px 4px;
}
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,0.65);
  padding: 9px 12px;
  border-radius: 7px;
  margin-bottom: 2px;
  font-size: 0.84rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.sidebar-nav .nav-link:hover  { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--color-primary); color: #fff; }
.sidebar-nav .nav-link i      { font-size: 1rem; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* ── Main Layout ─────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar h5 { font-size: 0.95rem; }

.content-body { padding: 24px; flex: 1; }

/* ── Filter Bar ─────────────────────────────────────────────────────────── */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

/* ── KPI Cards ──────────────────────────────────────────────────────────── */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 16px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s, transform 0.15s;
}
.kpi-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.kpi-card-alert { border-color: #fbbf24; }

.kpi-icon {
  width: 38px; height: 38px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; margin-bottom: 10px;
}
.kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; color: var(--text-primary); }
.kpi-unit  { font-size: 0.85rem; font-weight: 400; color: var(--text-muted); margin-left: 2px; }
.kpi-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; font-weight: 500; }
.kpi-bar   { height: 4px; background: #e5e7eb; border-radius: 2px; margin-top: 8px; overflow: hidden; }
.kpi-bar-fill { height: 100%; border-radius: 2px; transition: width 0.6s ease; }

/* ── Chart Cards ─────────────────────────────────────────────────────────── */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.chart-card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chart-card-body { padding: 18px; }

/* ── Score Cards ─────────────────────────────────────────────────────────── */
.score-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 16px;
  box-shadow: var(--shadow-card);
  text-align: center;
}
.score-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.score-value { font-size: 2rem; font-weight: 700; margin: 4px 0; }
.score-bar   { height: 6px; background: #e5e7eb; border-radius: 3px; margin-top: 8px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 3px; transition: width 0.8s ease; }

/* ── Agent Status Rows ───────────────────────────────────────────────────── */
.agent-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
}
.agent-row:last-child { border-bottom: none; }
.agent-icon-wrap {
  width: 32px; height: 32px; flex-shrink: 0;
  background: #f0f4ff;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-primary); font-size: 0.95rem;
}
.agent-badge-idle    { background: #f3f4f6 !important; color: #6b7280 !important; border: 1px solid #d1d5db !important; }
.agent-badge-running { background: #dcfce7 !important; color: #166534 !important; border: 1px solid #86efac !important; animation: pulse 1.5s infinite; }
.agent-badge-error   { background: #fee2e2 !important; color: #991b1b !important; border: 1px solid #fca5a5 !important; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* ── Table Styling ────────────────────────────────────────────────────────── */
.calls-table thead th {
  background: #fafafa;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
  padding: 10px 12px;
  white-space: nowrap;
}
.calls-table tbody td {
  padding: 10px 12px;
  vertical-align: middle;
}
.calls-table tbody tr:hover { background: #f9fafb; }

/* ── Score Pills ──────────────────────────────────────────────────────────── */
.score-pill {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 22px;
  border-radius: 5px;
  font-size: 0.78rem; font-weight: 700;
}
.score-good { background: #dcfce7; color: #166534; }
.score-warn { background: #fef3c7; color: #92400e; }
.score-bad  { background: #fee2e2; color: #991b1b; }

/* ── Risk Badges ──────────────────────────────────────────────────────────── */
.risk-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.73rem; font-weight: 700;
  letter-spacing: 0.04em;
}
.risk-high   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.risk-medium { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.risk-low    { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

/* ── Status Badges ────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.73rem; font-weight: 600;
}
.status-pending       { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.status-approved      { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.status-escalated     { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.status-auto_approved { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ── Sentiment Badges ─────────────────────────────────────────────────────── */
.sentiment-badge    { font-size: 0.78rem; font-weight: 500; }
.sentiment-positive { color: var(--color-success); }
.sentiment-negative { color: var(--color-danger); }
.sentiment-neutral  { color: var(--color-warning); }

/* ── Transcript Box ───────────────────────────────────────────────────────── */
.transcript-box {
  background: #0f1923;
  color: #d1d5db;
  padding: 16px;
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
  font-family: "Fira Code", "Cascadia Code", "Consolas", monospace;
}

/* ── Coaching List ────────────────────────────────────────────────────────── */
.coaching-list {
  padding-left: 1.2rem;
  list-style: none;
}
.coaching-list li {
  position: relative;
  padding-left: 1.2rem;
  margin-bottom: 6px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #374151;
}
.coaching-list li::before {
  content: '›';
  position: absolute;
  left: 0;
  font-weight: 700;
  color: #9ca3af;
}

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}
.empty-state .display-6 { font-size: 2.5rem; }

/* ── Utility ─────────────────────────────────────────────────────────────── */
.font-mono { font-family: "Cascadia Code", "Fira Code", "Consolas", monospace; }
.bg-purple         { background-color: var(--color-purple) !important; }
.bg-purple-subtle  { background-color: #f3f0ff !important; }
.text-purple       { color: var(--color-purple) !important; }

/* ── Subtle Color utilities (Bootstrap doesn't always include these) ───────── */
.bg-primary-subtle  { background-color: #eff6ff !important; }
.bg-success-subtle  { background-color: #f0fdf4 !important; }
.bg-danger-subtle   { background-color: #fef2f2 !important; }
.bg-warning-subtle  { background-color: #fffbeb !important; }
.bg-info-subtle     { background-color: #ecfeff !important; }
.bg-secondary-subtle{ background-color: #f9fafb !important; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 992px) {
  .sidebar       { transform: translateX(-100%); }
  .sidebar-open  { transform: translateX(0); }
  .main-content  { margin-left: 0; }
}

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

/* ── Animations ─────────────────────────────────────────────────────────── */
.chart-card, .kpi-card {
  animation: fadeInUp 0.3s ease both;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
