/* style.css — CPI AR Dashboard */

/* ── Navbar ── */
.cpi-navbar {
  background: linear-gradient(135deg, #0d1b2a 0%, #1a3a5c 100%);
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.cpi-navbar .navbar-brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: .02em;
}
.cpi-navbar .nav-link {
  font-size: .85rem;
  color: rgba(255,255,255,.8) !important;
  transition: color .15s;
}
.cpi-navbar .nav-link:hover,
.cpi-navbar .nav-link:focus {
  color: #fff !important;
}
.cpi-navbar .dropdown-menu {
  font-size: .85rem;
}

/* ── Page background ── */
body {
  background-color: #f4f6f9;
  font-size: .9rem;
}

/* ── Card header ── */
.cpi-card-header {
  background: linear-gradient(90deg, #0d1b2a, #1a3a5c);
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  padding: .45rem .75rem;
  letter-spacing: .03em;
}

/* ── KPI Cards ── */
.kpi-card {
  transition: transform .15s, box-shadow .15s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,.12) !important;
}
.kpi-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6c757d;
  line-height: 1.2;
}
.kpi-value {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.15;
}

/* ── Filter bar ── */
.filter-bar {
  background: #fff;
  border: 1px solid #dee2e6;
}

/* ── Dashboard nav cards (index) ── */
.dashboard-nav-card {
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .2s, transform .15s, box-shadow .15s;
}
.dashboard-nav-card:hover {
  border-color: #0d6efd;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(13,110,253,.15) !important;
}
.dash-icon {
  font-size: 2.2rem;
  line-height: 1;
}

/* ── Login ── */
.login-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #0d1b2a 0%, #1a3a5c 60%, #0d6efd 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 100%;
  max-width: 400px;
  border: none;
  border-radius: 1rem;
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}

/* ── Small badge button ── */
.btn-xs {
  padding: .15rem .4rem;
  font-size: .72rem;
  line-height: 1.3;
  border-radius: .25rem;
}

/* ── Tables ── */
.table th {
  font-size: .78rem;
  white-space: nowrap;
}
.table td {
  font-size: .82rem;
  vertical-align: middle;
}

/* ── Insight cards animation ── */
#insightsPanel .card {
  animation: fadeInUp .3s ease both;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── DataTables overrides ── */
div.dataTables_wrapper div.dataTables_filter input {
  border: 1px solid #dee2e6;
  border-radius: .375rem;
  padding: .25rem .5rem;
  font-size: .82rem;
}
div.dataTables_wrapper div.dataTables_length select {
  border: 1px solid #dee2e6;
  border-radius: .375rem;
  padding: .2rem .4rem;
  font-size: .82rem;
}

/* ── Tab nav ── */
.nav-tabs .nav-link {
  font-size: .82rem;
  font-weight: 600;
}

/* ── Scrollable table wrapper ── */
.tbl-scroll {
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
}
.tbl-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #212529;
  color: #fff;
}

/* ── ADR status badges ── */
.badge-open    { background:#dc3545; }
.badge-pending { background:#fd7e14; }
.badge-closed  { background:#198754; }

/* ── Responsive chart min-height ── */
.chart-wrap { position: relative; min-height: 180px; }

/* ══════════════════════════════════════════════════
   ── Shell / Sidebar layout ──
   ══════════════════════════════════════════════════ */
.cpi-topbar {
  height: 48px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1030;
}

.cpi-shell {
  display: flex;
  margin-top: 48px;
  min-height: calc(100vh - 48px);
}

/* Sidebar */
.cpi-sidebar {
  width: 210px;
  background: linear-gradient(180deg, #0d1b2a 0%, #0f2236 100%);
  position: fixed;
  top: 48px;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .2s ease;
  z-index: 1020;
  display: flex;
  flex-direction: column;
  padding-top: .4rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.cpi-sidebar.collapsed {
  width: 52px;
}

.cpi-sidebar.collapsed .sidebar-section-label,
.cpi-sidebar.collapsed .sidebar-link span,
.cpi-sidebar.collapsed .sidebar-footer {
  display: none;
}

/* Main content area */
.cpi-main {
  margin-left: 210px;
  flex: 1;
  transition: margin-left .2s ease;
  min-width: 0;
}

.cpi-sidebar.collapsed + .cpi-main {
  margin-left: 52px;
}

/* Sidebar nav links */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .42rem .75rem;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: .81rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, color .15s;
  border-radius: 0 .4rem .4rem 0;
  margin-right: .5rem;
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}

.sidebar-link.active {
  background: rgba(13,110,253,.2);
  color: #5fa8ff;
  border-left-color: #0d6efd;
}

.sidebar-link i {
  font-size: 1rem;
  width: 1.2rem;
  text-align: center;
  flex-shrink: 0;
}

/* Section labels */
.sidebar-section-label {
  font-size: .63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.35);
  padding: .35rem .75rem .1rem;
}

/* Footer */
.sidebar-footer {
  margin-top: auto;
  padding: .65rem .75rem;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* Sidebar scrollbar WebKit */
.cpi-sidebar::-webkit-scrollbar { width: 4px; }
.cpi-sidebar::-webkit-scrollbar-track { background: transparent; }
.cpi-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

/* Sidebar toggle button */
.sidebar-toggle { line-height: 1; padding: .2rem .4rem !important; }

/* ── Responsive: collapse sidebar below md ── */
@media (max-width: 767.98px) {
  .cpi-sidebar {
    transform: translateX(-100%);
    width: 210px !important;
  }
  .cpi-sidebar.mobile-open {
    transform: translateX(0);
  }
  .cpi-main {
    margin-left: 0 !important;
  }
}
