/* ===== PBC Linear Brand Theme (Bootstrap 5.3) ===== */
/* Primary Blue: #0078E6 | Dark Blue: #005BA6 | Accent Red: #E60514 */
/* Light Grey: #BACBD4 | Dark Grey: #98B1BE | White: #FFFFFF */

/* --- Global --- */
body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #f4f6f8;
}

table {
  font-family: 'Roboto Condensed', 'Roboto', sans-serif;
}

a { color: #0078E6; }
a:hover { color: #005BA6; }

/* --- Bootstrap Color Overrides --- */
.btn-primary {
  background-color: #0078E6;
  border-color: #0078E6;
}
.btn-primary:hover, .btn-primary:active, .btn-primary:focus {
  background-color: #005BA6;
  border-color: #005BA6;
}
.btn-outline-primary {
  color: #0078E6;
  border-color: #0078E6;
}
.btn-outline-primary:hover {
  background-color: #0078E6;
  border-color: #0078E6;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background: #1b2a3d;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: width 0.2s ease, transform 0.2s ease;
  overflow: hidden;
}

.sidebar-brand {
  padding: 18px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-brand a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.sidebar-logo {
  flex-shrink: 0;
  filter: brightness(0) invert(1);
}

.sidebar-logo--full {
  height: 26px;
  display: block;
}

.sidebar-logo--icon {
  height: 28px;
  display: none;
  filter: none;
}

.sidebar-section-label {
  padding: 20px 20px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.3);
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 4px 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin: 2px 10px;
  border-radius: 8px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-item:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.95);
}

.sidebar-item.active {
  background: rgba(0, 120, 230, 0.2);
  color: #fff;
  font-weight: 500;
}

.sidebar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-item.active .sidebar-icon {
  color: #4da6ff;
}

.sidebar-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.sidebar-toggle {
  background: none;
  border: none;
  color: #98B1BE;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.sidebar-toggle:hover { color: #fff; }

/* Collapsed state */
.sidebar-collapsed .sidebar { width: 60px; }
.sidebar-collapsed .sidebar-logo--full { display: none; }
.sidebar-collapsed .sidebar-logo--icon { display: block; }
.sidebar-collapsed .sidebar-label,
.sidebar-collapsed .sidebar-section-label { display: none; }
.sidebar-collapsed .sidebar-brand { padding: 14px 0; }
.sidebar-collapsed .sidebar-brand a { justify-content: center; }
.sidebar-collapsed .sidebar-item {
  justify-content: center;
  padding: 10px 0;
  margin: 2px 8px;
  gap: 0;
}
.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }
.sidebar-collapsed .sidebar-footer {
  display: flex;
  justify-content: center;
  padding: 12px 0;
}

/* Mobile: sidebar off-screen by default */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); width: 240px !important; }
  .sidebar.show { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1039;
    display: none;
  }
  .sidebar.show + .sidebar-backdrop { display: block; }
  .app-main { margin-left: 0 !important; }
  .sidebar-collapsed .sidebar { transform: translateX(-100%); }
  .sidebar-collapsed .app-main { margin-left: 0; }
}

/* ===== TOPBAR ===== */
.topbar {
  height: 48px;
  background: #fff;
  border-bottom: 1px solid #e8eaed;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.topbar-title {
  font-size: 15px;
  font-weight: 500;
  color: #333;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 13px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #666;
}

.topbar-signout {
  color: #0078E6 !important;
  text-decoration: none;
  font-size: 13px;
}

.topbar-signout:hover { text-decoration: underline; }

/* Mobile menu toggle in topbar */
.topbar-menu-toggle {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #333;
  cursor: pointer;
  display: none;
  padding: 4px;
}

@media (max-width: 991.98px) {
  .topbar-menu-toggle { display: flex; }
}

/* ===== APP LAYOUT ===== */
.app-main {
  margin-left: 240px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.2s ease;
}

.sidebar-collapsed .app-main {
  margin-left: 60px;
}

.app-content {
  flex: 1;
  padding: 1.5rem;
}

.app-content--flush {
  padding: 0;
}

/* --- Login Page --- */
.login-hero {
  background: linear-gradient(135deg, #005BA6 0%, #0078E6 100%);
}

.login-logo {
  height: 40px;
  margin-bottom: 0.75rem;
}

.divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: #98B1BE;
  font-size: 13px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #BACBD4;
}

.divider::before { margin-right: 12px; }
.divider::after { margin-left: 12px; }

/* --- Users Split-Panel Layout --- */
.users-panel {
  height: calc(100vh - 48px);
}

.users-sidebar {
  border-right: 1px solid #dee2e6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}

.users-list {
  flex: 1;
  overflow-y: auto;
}

.user-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f0f2f4;
  cursor: pointer;
  transition: background 0.1s;
}

.user-list-item:hover { background: #f4f8fc; }
.user-list-item--active {
  background: #e8f4fd;
  border-left: 3px solid #0078E6;
}

.user-list-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.user-list-info > div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- User Avatars --- */
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #BACBD4;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

.user-avatar--lg {
  width: 64px;
  height: 64px;
  font-size: 26px;
}

/* --- Status Dots --- */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot--active { background: #198754; }
.status-dot--pending { background: #ffc107; }
.status-dot--disabled { background: #E60514; }

/* --- User Detail Panel --- */
.users-detail {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  background: #f4f6f8;
}

.users-detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* --- Audit Log --- */
.audit-entry {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #f0f2f4;
  margin-bottom: 0 !important;
}

/* --- Section Headers --- */
.section-heading {
  background: linear-gradient(135deg, #005BA6 0%, #0078E6 100%);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 4px 4px 0 0;
  font-weight: 700;
  font-size: 15px;
}

/* --- Version Footer --- */
.version-footer {
  position: fixed;
  bottom: 12px;
  right: 12px;
  font-size: 11px;
  color: #98B1BE;
  font-family: 'Roboto Condensed', monospace;
  z-index: 50;
}
