/* ==============================================================================
   CareerBridge Enterprise Application Theme & Modern App Shell Layout
   Features: Fixed Header, Grouped Sidebar Navigation, Responsive Content Area
============================================================================== */

:root {
  --cb-navy-950: #060e1e;
  --cb-navy-900: #0b172a;
  --cb-navy-850: #101e35;
  --cb-navy-800: #162a4a;
  --cb-navy-700: #1e3a63;
  --cb-navy-600: #2a4e80;
  
  --cb-primary: #1d4ed8;
  --cb-primary-hover: #1e40af;
  --cb-primary-light: #eff6ff;
  
  --cb-accent: #059669;
  --cb-accent-hover: #047857;
  --cb-accent-light: #ecfdf5;
  
  --cb-warning: #d97706;
  --cb-warning-light: #fffbeb;
  
  --cb-danger: #dc2626;
  --cb-danger-bg: #fef2f2;
  
  --cb-bg-app: #f4f6fa;
  --cb-bg-card: #ffffff;
  --cb-bg-sidebar: #ffffff;
  --cb-bg-header: #ffffff;
  
  --cb-text-main: #0f172a;
  --cb-text-muted: #64748b;
  --cb-text-light: #94a3b8;
  
  --cb-border: #e2e8f0;
  --cb-border-subtle: #edf2f7;
  --cb-border-dark: #cbd5e1;
  
  --cb-radius-xs: 4px;
  --cb-radius-sm: 8px;
  --cb-radius-md: 12px;
  --cb-radius-lg: 16px;
  
  --cb-shadow-subtle: 0 1px 3px rgba(0,0,0,0.05);
  --cb-shadow-sm: 0 2px 6px rgba(0,0,0,0.06);
  --cb-shadow-md: 0 6px 16px rgba(0,0,0,0.08);
  --cb-shadow-lg: 0 12px 28px rgba(0,0,0,0.12);
  
  --cb-sidebar-width: 260px;
  --cb-header-height: 64px;
  --cb-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Base Reset & Global Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: var(--cb-font-sans);
  background-color: var(--cb-bg-app);
  color: var(--cb-text-main);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: var(--cb-primary);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--cb-primary-hover);
}

/* ==============================================================================
   Modern App Shell (Header + Sidebar + Content Layout)
============================================================================== */

#cb-app-shell {
  display: flex;
  min-height: 100vh;
  background-color: var(--cb-bg-app);
  position: relative;
}

/* Hide public marketing footer when inside app-shell */
#cb-app-shell ~ #cb-footer,
#cb-app-shell + #cb-footer {
  display: none !important;
}

/* --- Top Header Bar --- */
.cb-app-header {
  position: fixed;
  top: 0;
  left: var(--cb-sidebar-width);
  right: 0;
  height: var(--cb-header-height);
  background: var(--cb-bg-header);
  border-bottom: 1px solid var(--cb-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 100;
  box-shadow: var(--cb-shadow-subtle);
}

.cb-header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.cb-workspace-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--cb-navy-900);
  background: #f8fafc;
  padding: 6px 14px;
  border-radius: var(--cb-radius-sm);
  border: 1px solid var(--cb-border);
}

.cb-status-dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.cb-header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.cb-live-clock {
  font-size: 12px;
  font-weight: 500;
  color: var(--cb-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  padding: 5px 10px;
  border-radius: var(--cb-radius-xs);
}

.cb-header-icon-btn {
  background: transparent;
  border: 1px solid var(--cb-border);
  width: 36px;
  height: 36px;
  border-radius: var(--cb-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cb-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.cb-header-icon-btn:hover {
  background: #f8fafc;
  color: var(--cb-navy-900);
  border-color: var(--cb-border-dark);
}

.cb-header-user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  background: #f8fafc;
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius-sm);
}

.cb-user-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cb-navy-900);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

/* --- Left Grouped Sidebar Navigation --- */
.cb-app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--cb-sidebar-width);
  background: var(--cb-bg-sidebar);
  border-right: 1px solid var(--cb-border);
  display: flex;
  flex-direction: column;
  z-index: 110;
  box-shadow: var(--cb-shadow-subtle);
}

.cb-sidebar-brand {
  height: var(--cb-header-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--cb-border);
}

.cb-sidebar-brand-img {
  height: 38px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
}

.cb-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cb-sidebar-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--cb-text-muted);
  margin-bottom: 8px;
  padding-left: 10px;
}

.cb-sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cb-sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--cb-radius-sm);
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}

.cb-sidebar-link svg {
  color: var(--cb-text-muted);
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.cb-sidebar-link:hover {
  background: #f1f5f9;
  color: var(--cb-navy-900);
}
.cb-sidebar-link:hover svg {
  color: var(--cb-primary);
}

.cb-sidebar-link.active {
  background: #eff6ff;
  color: var(--cb-primary);
  font-weight: 600;
}
.cb-sidebar-link.active svg {
  color: var(--cb-primary);
}

.cb-sidebar-footer {
  padding: 16px 18px;
  border-top: 1px solid var(--cb-border);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cb-sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--cb-navy-900);
}
.cb-sidebar-user-role {
  font-size: 11px;
  color: var(--cb-text-muted);
  text-transform: capitalize;
}

.cb-sidebar-logout-btn {
  background: transparent;
  border: 1px solid var(--cb-border);
  padding: 5px 8px;
  border-radius: var(--cb-radius-xs);
  color: var(--cb-danger);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.cb-sidebar-logout-btn:hover {
  background: var(--cb-danger-bg);
  border-color: #fca5a5;
}

/* --- Main Content Area Layout --- */
.cb-main-content-layout {
  margin-left: var(--cb-sidebar-width);
  margin-top: var(--cb-header-height);
  padding: 28px 32px 60px 32px;
  flex: 1;
  width: calc(100% - var(--cb-sidebar-width));
}

/* Legacy standalone main container for public landing pages */
.cb-main-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 32px 24px 80px 24px;
}

/* Public Navbar */
.cb-navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--cb-border);
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 24px;
}
.cb-navbar-inner {
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cb-nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 20px;
}
.cb-nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #334155;
  font-weight: 500;
  font-size: 13px;
}
.cb-nav-link:hover {
  color: var(--cb-primary);
}

/* Public Footer */
.cb-footer {
  background: var(--cb-navy-950);
  color: #f8fafc;
  padding: 48px 24px 24px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: auto;
}
.cb-footer-inner {
  max-width: 1360px;
  margin: 0 auto;
}
.cb-footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 36px;
}
.cb-footer-heading {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #94a3b8;
  margin-bottom: 16px;
}
.cb-footer-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cb-footer-list a {
  color: #cbd5e1;
  font-size: 13px;
}
.cb-footer-list a:hover {
  color: #ffffff;
}
.cb-footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #94a3b8;
}

/* ==============================================================================
   UI Component Library: Cards, Grids, Tables, Forms, Modals, Toasts
============================================================================== */

/* Page Headers */
.cb-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.cb-page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--cb-navy-900);
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.cb-page-desc {
  font-size: 13px;
  color: var(--cb-text-muted);
}

.cb-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Card Panels */
.cb-card {
  background: var(--cb-bg-card);
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius-md);
  box-shadow: var(--cb-shadow-subtle);
  overflow: hidden;
  margin-bottom: 24px;
}

.cb-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--cb-border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
}

.cb-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--cb-navy-900);
}

.cb-card-subtitle {
  font-size: 12px;
  color: var(--cb-text-muted);
  margin-top: 2px;
}

.cb-card-body {
  padding: 24px;
}

/* Metrics & Stats Grid */
.cb-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.cb-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.cb-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.cb-stat-card {
  background: var(--cb-bg-card);
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius-md);
  padding: 20px;
  box-shadow: var(--cb-shadow-subtle);
  display: flex;
  flex-direction: column;
  position: relative;
}

.cb-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--cb-radius-sm);
  background: #f8fafc;
  border: 1px solid var(--cb-border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.cb-stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--cb-navy-900);
  line-height: 1.2;
}

.cb-stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--cb-text-muted);
  margin-top: 4px;
}

/* Tables */
.cb-table-responsive {
  width: 100%;
  overflow-x: auto;
}

.cb-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.cb-table th {
  background: #f8fafc;
  padding: 12px 18px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--cb-text-muted);
  border-bottom: 1px solid var(--cb-border);
}

.cb-table td {
  padding: 14px 18px;
  font-size: 13px;
  border-bottom: 1px solid var(--cb-border-subtle);
  vertical-align: middle;
}

.cb-table tbody tr:hover {
  background-color: #fcfdfe;
}

/* Buttons */
.cb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--cb-radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  line-height: 1;
}

.cb-btn-primary {
  background-color: var(--cb-primary);
  color: #ffffff;
}
.cb-btn-primary:hover {
  background-color: var(--cb-primary-hover);
  color: #ffffff;
}

.cb-btn-secondary {
  background-color: #ffffff;
  color: #334155;
  border-color: var(--cb-border);
}
.cb-btn-secondary:hover {
  background-color: #f8fafc;
  color: var(--cb-navy-900);
  border-color: var(--cb-border-dark);
}

.cb-btn-accent {
  background-color: var(--cb-accent);
  color: #ffffff;
}
.cb-btn-accent:hover {
  background-color: var(--cb-accent-hover);
  color: #ffffff;
}

.cb-btn-danger {
  background-color: var(--cb-danger);
  color: #ffffff;
}
.cb-btn-danger:hover {
  background-color: #b91c1c;
  color: #ffffff;
}

.cb-btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.cb-btn-google {
  background: #ffffff;
  border: 1px solid var(--cb-border);
  color: #1e293b;
  font-weight: 600;
  width: 100%;
  padding: 10px;
}
.cb-btn-google:hover {
  background: #f8fafc;
  border-color: var(--cb-border-dark);
}

/* Form Controls */
.cb-form-group {
  margin-bottom: 16px;
}

.cb-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--cb-navy-900);
  margin-bottom: 6px;
}

.cb-form-input, .cb-form-select, .cb-form-textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--cb-text-main);
  background-color: #ffffff;
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cb-form-input:focus, .cb-form-select:focus, .cb-form-textarea:focus {
  border-color: var(--cb-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

/* Status Indicators */
.cb-status-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--cb-radius-xs);
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

.cb-status-active {
  background-color: #dcfce7;
  color: #15803d;
}
.cb-status-suspended {
  background-color: #fee2e2;
  color: #b91c1c;
}
.cb-status-pending {
  background-color: #fef3c7;
  color: #b45309;
}
.cb-status-info {
  background-color: #e0f2fe;
  color: #0369a1;
}

.cb-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

/* Modals */
.cb-modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cb-modal-backdrop.open {
  display: flex;
}

.cb-modal-box {
  background: #ffffff;
  border-radius: var(--cb-radius-md);
  width: 100%;
  max-width: 580px;
  box-shadow: var(--cb-shadow-lg);
  border: 1px solid var(--cb-border);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.cb-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--cb-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cb-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--cb-navy-900);
}

.cb-modal-close-btn {
  background: transparent;
  border: none;
  color: var(--cb-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cb-modal-close-btn:hover {
  color: var(--cb-navy-900);
}

.cb-modal-body {
  padding: 24px;
  overflow-y: auto;
}

.cb-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--cb-border);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Toasts */
.cb-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cb-toast {
  padding: 12px 18px;
  border-radius: var(--cb-radius-sm);
  background: #ffffff;
  border: 1px solid var(--cb-border);
  box-shadow: var(--cb-shadow-md);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInToast 0.25s ease forwards;
}

.cb-toast-success {
  border-left: 4px solid var(--cb-accent);
  color: #166534;
}
.cb-toast-error {
  border-left: 4px solid var(--cb-danger);
  color: #991b1b;
}
.cb-toast-info {
  border-left: 4px solid var(--cb-primary);
  color: #1e40af;
}

@keyframes slideInToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Responsive Rules */
@media (max-width: 992px) {
  .cb-app-header {
    left: 0;
  }
  .cb-app-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .cb-app-sidebar.open {
    transform: translateX(0);
  }
  .cb-main-content-layout {
    margin-left: 0;
    width: 100%;
    padding: 20px 16px;
  }
}
