/* === GLOBAL THEME – BRI CORPORATE BLUE === */
:root {
  --primary-color: #0b4ea2;
  --primary-gradient: linear-gradient(135deg, #0b4ea2 0%, #1a5bb3 100%);
  --bg-color: #f3f4f6;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --card-bg: #ffffff;
  --topbar-height: 64px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 250px;
  background: var(--primary-color);
  color: #e5e7eb;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Desktop: Push content for fixed sidebar */
@media (min-width: 992px) {
  .app-main {
    margin-left: 250px;
  }
}

.app-sidebar .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.app-sidebar .brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 1rem;
}

.app-sidebar .brand-text-main {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}

.app-sidebar .brand-text-sub {
  font-size: 0.75rem;
  opacity: 0.8;
  color: #dbeafe;
}

.app-sidebar-nav {
  list-style: none;
  padding-left: 0;
  margin: 0;
  flex: 1;
  overflow-y: auto;
}

.app-sidebar-nav li {
  margin-bottom: 0.35rem;
}

.app-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #bfdbfe;
  font-size: 0.875rem;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.app-sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.app-sidebar-nav a.active {
  background: #ffffff;
  color: var(--primary-color);
  font-weight: 600;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.app-sidebar-footer {
  font-size: 0.75rem;
  color: #bfdbfe;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* Main area */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-color);
}

/* Topbar */
.app-topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.app-topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-color);
}

.app-topbar-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.app-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge-soft {
  background-color: #eff6ff;
  color: var(--primary-color);
  border: 1px solid #dbeafe;
  border-radius: 999px;
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  font-weight: 500;
}

.btn-topbar {
  font-size: 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--primary-color);
  padding: 0.35rem 1rem;
  background: var(--primary-color);
  color: #ffffff;
  transition: opacity 0.2s;
}

.btn-topbar:hover {
  opacity: 0.9;
}

/* Content */
.app-content {
  padding: 2rem;
  flex: 1;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #111827;
}

.page-subtitle {
  font-size: 0.95rem;
  color: #6b7280;
}

/* Cards */
.card {
  border-radius: 12px !important;
  border: 1px solid rgba(0,0,0,0.05) !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03) !important;
  background: var(--card-bg);
  transition: transform 0.2s, box-shadow 0.2s;
}

/* .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02) !important;
} */

.card-header {
  background: transparent;
  border-bottom: 1px solid #f3f4f6;
  padding: 1rem 1.25rem;
}

/* KPI Stats */
.kpi-label {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

.kpi-value {
  font-size: 1.875rem;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.02em;
}

/* Table overrides */
.table-responsive {
  border-radius: 12px;
  background: #ffffff;
}

.table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f9fafb;
  color: #4b5563;
  padding: 1rem;
  font-weight: 600;
  border-bottom: 2px solid #e5e7eb;
}
/* Allow custom styling for specific headers if they have background class */
.table thead th.bg-primary {
    background-color: var(--primary-color) !important;
    color: white !important;
}

.table tbody td {
  font-size: 0.875rem;
  padding: 1rem;
  color: #374151;
  vertical-align: middle;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  box-shadow: none;
  background-color: #f9fafb;
}

.table-hover > tbody > tr:hover > * {
  background-color: #eff6ff;
}

/* Mobile Overlay */
.app-overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1030;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

/* Responsive Logic */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  
  body.sidebar-open .app-sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  }
  
  body.sidebar-open .app-overlay {
    opacity: 1;
    pointer-events: auto;
  }
  
  .app-topbar {
    background: var(--primary-color); /* Maintain solid color on mobile topbar for contrast */
    color: white;
    padding: 0 1rem;
  }
  
  .app-topbar-title {
    color: white;
  }
  
  .app-topbar-sub {
    color: rgba(255,255,255,0.8);
  }
  
  .app-content {
    padding: 1rem;
  }

  /* Make sure topbar button looks right on mobile primary bg */
  #sidebarToggle {
      color: white !important;
  }
}
