/**
 * ==========================================================================
 * BLUECAKE OS — UNIFIED SAAS DESIGN SYSTEM (2026 EDITION)
 * ==========================================================================
 * Single Source of Truth for Visual Language across Admin, Client & Team.
 * Inspired by modern high-end B2B SaaS interfaces.
 * 
 * Primary Visual DNA:
 * - Clean white/neutral canvas with generous whitespace
 * - Electric Blue primary accent (#0066FF / #0B57F7)
 * - 16px soft rounded cards with subtle 1px border (#EAECF0)
 * - Soft elevation shadows (no heavy blur)
 * - Consistent Tajawal typography with tabular numbers
 * - Minimal, intentional, polished micro-interactions
 * ==========================================================================
 */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ==========================================================================
   1. DESIGN TOKENS (LIGHT THEME DEFAULT)
   ========================================================================== */
:root, [data-bs-theme="light"] {
  /* Brand Accents */
  --bc-primary: #0066FF;
  --bc-primary-hover: #0052CC;
  --bc-primary-active: #004099;
  --bc-primary-soft: rgba(0, 102, 255, 0.08);
  --bc-primary-subtle: rgba(0, 102, 255, 0.04);
  --bc-primary-border: rgba(0, 102, 255, 0.20);
  --bc-primary-gradient: linear-gradient(135deg, #0066FF 0%, #0052CC 100%);
  --bc-primary-gradient-subtle: linear-gradient(135deg, rgba(0, 102, 255, 0.08) 0%, rgba(0, 102, 255, 0.02) 100%);
  --bc-brand-secondary: #0CBDFB;

  /* Surfaces & Backgrounds */
  --bc-background: #F8FAFC;
  --bc-surface: #FFFFFF;
  --bc-surface-raised: #FFFFFF;
  --bc-surface-muted: #F1F5F9;
  --bc-surface-subtle: #F8FAFC;

  /* Borders & Dividers */
  --bc-border: #EAECF0;
  --bc-border-subtle: #F2F4F7;
  --bc-border-hover: #D0D5DD;
  --bc-border-strong: #CBD5E1;

  /* Typography Colors */
  --bc-text-primary: #0F172A;
  --bc-text-secondary: #475569;
  --bc-text-muted: #64748B;
  --bc-text-dim: #94A3B8;
  --bc-text-white: #FFFFFF;

  /* Functional Status Colors */
  --bc-success: #10B981;
  --bc-success-soft: rgba(16, 185, 129, 0.10);
  --bc-success-border: rgba(16, 185, 129, 0.25);
  --bc-success-text: #059669;

  --bc-warning: #F59E0B;
  --bc-warning-soft: rgba(245, 158, 11, 0.10);
  --bc-warning-border: rgba(245, 158, 11, 0.25);
  --bc-warning-text: #D97706;

  --bc-danger: #EF4444;
  --bc-danger-soft: rgba(239, 68, 68, 0.10);
  --bc-danger-border: rgba(239, 68, 68, 0.25);
  --bc-danger-text: #DC2626;

  --bc-info: #0EA5E9;
  --bc-info-soft: rgba(14, 165, 233, 0.10);
  --bc-info-border: rgba(14, 165, 233, 0.25);
  --bc-info-text: #0284C7;

  --bc-purple: #8B5CF6;
  --bc-purple-soft: rgba(139, 92, 246, 0.10);
  --bc-purple-border: rgba(139, 92, 246, 0.25);
  --bc-purple-text: #7C3AED;

  /* Elevation Shadows */
  --bc-shadow-xs: 0 1px 2px 0 rgba(16, 24, 40, 0.04);
  --bc-shadow-sm: 0 1px 3px 0 rgba(16, 24, 40, 0.05), 0 1px 2px -1px rgba(16, 24, 40, 0.03);
  --bc-shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.06), 0 2px 4px -2px rgba(16, 24, 40, 0.04);
  --bc-shadow-lg: 0 12px 24px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03);
  --bc-shadow-xl: 0 20px 32px -8px rgba(16, 24, 40, 0.10), 0 8px 12px -4px rgba(16, 24, 40, 0.04);

  /* Border Radii */
  --bc-radius-xs: 4px;
  --bc-radius-sm: 6px;
  --bc-radius-md: 10px;
  --bc-radius-lg: 16px;   /* Standard card radius */
  --bc-radius-xl: 20px;
  --bc-radius-2xl: 24px;
  --bc-radius-pill: 9999px;

  /* Layout Measurements */
  --bc-sidebar-width: 260px;
  --bc-sidebar-collapsed-width: 72px;
  --bc-header-height: 68px;

  /* Transitions */
  --bc-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --bc-transition-base: 220ms cubic-bezier(0.4, 0, 0.2, 1);
  --bc-transition-smooth: 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   2. DARK THEME TOKENS
   ========================================================================== */
[data-bs-theme="dark"] {
  --bc-background: #090E17;
  --bc-surface: #0F172A;
  --bc-surface-raised: #162036;
  --bc-surface-muted: #1E293B;
  --bc-surface-subtle: #131D31;

  --bc-border: #1E293B;
  --bc-border-subtle: #182234;
  --bc-border-hover: #334155;
  --bc-border-strong: #475569;

  --bc-text-primary: #F8FAFC;
  --bc-text-secondary: #CBD5E1;
  --bc-text-muted: #94A3B8;
  --bc-text-dim: #64748B;

  --bc-primary-soft: rgba(0, 102, 255, 0.18);
  --bc-primary-subtle: rgba(0, 102, 255, 0.10);
  --bc-primary-border: rgba(0, 102, 255, 0.35);

  --bc-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.40);
  --bc-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.50);
  --bc-shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.60);
  --bc-shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.70);
  --bc-shadow-xl: 0 20px 32px -8px rgba(0, 0, 0, 0.80);
}

[data-bs-theme="dark"] .settings-sidebar,
[data-bs-theme="dark"] .settings-content-card,
[data-bs-theme="dark"] .card-premium,
[data-bs-theme="dark"] .stat-box,
[data-bs-theme="dark"] .card {
  background-color: var(--bc-surface) !important;
  border-color: var(--bc-border) !important;
  color: var(--bc-text-primary) !important;
}

/* ==========================================================================
   3. GLOBAL RESET & TYPOGRAPHY SYSTEM
   ========================================================================== */
html, body {
  font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  background-color: var(--bc-background) !important;
  color: var(--bc-text-primary) !important;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ensure Tajawal font across all typography & form elements */
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6,
p, span, a, label, button, input, select, textarea, .btn, .badge, .dropdown-item, .table {
  font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Numbers & Metrics: Crisp tabular figures */
.bc-metric-number, .tabular-nums, .stat-value, .kpi-value {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* Page titles */
.bc-page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--bc-text-primary);
  line-height: 1.25;
  margin-bottom: 0.25rem;
}

.bc-page-subtitle {
  font-size: 0.875rem;
  color: var(--bc-text-muted);
  font-weight: 500;
  margin-bottom: 0;
}

/* ==========================================================================
   4. LAYOUT SYSTEM (SIDEBAR & HEADER)
   ========================================================================== */

/* Master Layout Wrapper - Ensures vertical flow of header, main content, and footer */
#layout-wrapper {
  display: block !important;
  width: 100% !important;
  min-height: 100vh !important;
  position: relative !important;
  background-color: var(--bc-background) !important;
  box-sizing: border-box !important;
}

/* Main App Wrapper */
.app-wrapper, main.app-wrapper {
  background-color: var(--bc-background) !important;
  min-height: calc(100vh - var(--bc-header-height)) !important;
  padding: 1.75rem 2rem 3.5rem 2rem !important;
  display: block !important;
  box-sizing: border-box !important;
  clear: both !important;
  transition: all var(--bc-transition-base);
}

/* Top App Header */
.app-header {
  height: var(--bc-header-height) !important;
  background-color: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid var(--bc-border) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
  display: flex !important;
  align-items: center !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 1050 !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-sizing: border-box !important;
}

.dropdown-menu,
.app-header .dropdown-menu {
  z-index: 2050 !important;
}

.header-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--bc-radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--bc-border);
  background: var(--bc-surface);
  color: var(--bc-text-secondary);
  transition: all var(--bc-transition-fast);
}

.header-icon-btn:hover {
  background: var(--bc-surface-muted);
  color: var(--bc-primary);
  border-color: var(--bc-border-hover);
}

/* Sidebar Styling */
.pe-app-sidebar {
  width: var(--bc-sidebar-width) !important;
  background-color: var(--bc-surface) !important;
  border-inline-end: 1px solid var(--bc-border) !important;
  box-shadow: none !important;
  display: flex !important;
  flex-direction: column !important;
  height: 100vh !important;
  position: fixed !important;
  top: 0 !important;
  z-index: 1010 !important;
  transition: all var(--bc-transition-smooth) !important;
}

.pe-app-sidebar-logo {
  height: var(--bc-header-height) !important;
  padding: 0 1.25rem !important;
  border-bottom: 1px solid var(--bc-border) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

.pe-app-sidebar-menu {
  flex: 1 1 auto !important;
  padding: 1rem 0.75rem !important;
  overflow-y: auto !important;
}

.pe-menu-title {
  font-size: 0.6875rem !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  color: var(--bc-text-dim) !important;
  padding: 0.75rem 0.75rem 0.35rem !important;
  margin-top: 0.5rem !important;
}

.pe-slide {
  margin-bottom: 3px !important;
}

/* Sidebar Nav Links */
.pe-nav-link {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  padding: 0.55rem 0.85rem !important;
  border-radius: var(--bc-radius-md) !important;
  color: var(--bc-text-secondary) !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  transition: all var(--bc-transition-fast) !important;
  position: relative !important;
}

.pe-nav-icon {
  font-size: 1.15rem !important;
  width: 20px !important;
  text-align: center !important;
  color: var(--bc-text-muted) !important;
  transition: color var(--bc-transition-fast) !important;
}

.pe-nav-link:hover {
  background-color: var(--bc-surface-muted) !important;
  color: var(--bc-primary) !important;
}

.pe-nav-link:hover .pe-nav-icon {
  color: var(--bc-primary) !important;
}

/* Active navigation item - Electric blue accent */
.pe-nav-link.active,
.pe-slide.active > .pe-nav-link {
  background-color: var(--bc-primary-soft) !important;
  color: var(--bc-primary) !important;
  font-weight: 700 !important;
}

.pe-nav-link.active .pe-nav-icon,
.pe-slide.active > .pe-nav-link .pe-nav-icon {
  color: var(--bc-primary) !important;
}

/* Submenu Styling */
.pe-slide-menu {
  list-style: none !important;
  padding: 0.25rem 0 !important;
  margin: 0 !important;
  margin-inline-start: 1.75rem !important;
  border-inline-start: 1px dashed var(--bc-border) !important;
}

.pe-slide-item .pe-nav-link {
  padding: 0.4rem 0.75rem !important;
  font-size: 0.8125rem !important;
}

/* Sidebar Daily Motivation Quote Card */
.bc-sidebar-quote-card {
  margin: 0.75rem 0.85rem !important;
  padding: 0.95rem 1rem !important;
  background: linear-gradient(135deg, #0052cc 0%, #1e3a8a 100%) !important;
  border-radius: var(--bc-radius-lg, 14px) !important;
  color: #FFFFFF !important;
  position: relative !important;
  overflow: hidden !important;
  box-shadow: 0 6px 16px rgba(0, 82, 204, 0.28) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  transition: all 0.3s ease !important;
}

.bc-sidebar-quote-card::before {
  content: "";
  position: absolute;
  top: -25px;
  right: -25px;
  width: 85px;
  height: 85px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

.bc-quote-header {
  position: relative;
  z-index: 2;
}

.bc-quote-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem !important;
  font-weight: 700 !important;
  background: rgba(255, 255, 255, 0.2) !important;
  backdrop-filter: blur(4px);
  color: #FFFFFF !important;
  padding: 0.2rem 0.55rem !important;
  border-radius: 20px !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  letter-spacing: 0.2px;
}

.bc-quote-spark-tag {
  font-size: 0.6875rem !important;
  font-weight: 600 !important;
  color: rgba(255, 255, 255, 0.9) !important;
}

.bc-quote-body {
  position: relative;
  z-index: 2;
  min-height: 42px;
}

.bc-quote-bg-icon {
  position: absolute;
  top: -6px;
  right: -8px;
  font-size: 2.2rem;
  color: rgba(255, 255, 255, 0.08);
  pointer-events: none;
  line-height: 1;
}

.bc-quote-text {
  font-size: 0.775rem !important;
  line-height: 1.5 !important;
  color: #F8FAFC !important;
  font-weight: 500 !important;
  transition: opacity 0.25s ease-in-out;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.bc-quote-actions {
  position: relative;
  z-index: 2;
}

.bc-quote-action-btn {
  border: none !important;
  border-radius: var(--bc-radius-pill, 20px) !important;
  font-weight: 700 !important;
  font-size: 0.725rem !important;
  transition: all var(--bc-transition-fast, 0.2s) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.35rem !important;
  text-decoration: none !important;
  padding: 0.35rem 0.75rem !important;
}

.bc-quote-btn-share {
  background: #FFFFFF !important;
  color: #0052cc !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
}

.bc-quote-btn-share:hover,
.bc-quote-btn-share:focus {
  background: #F0F7FF !important;
  color: #003d99 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.16) !important;
}

.bc-quote-btn-shuffle {
  background: rgba(255, 255, 255, 0.2) !important;
  color: #FFFFFF !important;
  width: 30px !important;
  height: 30px !important;
  padding: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  border-radius: 50% !important;
  flex-shrink: 0;
}

.bc-quote-btn-shuffle:hover {
  background: rgba(255, 255, 255, 0.35) !important;
  color: #FFFFFF !important;
  transform: rotate(180deg) scale(1.08) !important;
}

.bc-quote-dropdown-menu {
  background: #FFFFFF !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
  padding: 0.4rem !important;
  min-width: 210px !important;
}

.bc-quote-dropdown-menu .dropdown-item {
  border-radius: 8px !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  color: #334155 !important;
  transition: all 0.15s ease !important;
}

.bc-quote-dropdown-menu .dropdown-item:hover {
  background-color: #F1F5F9 !important;
  color: #0052cc !important;
  transform: translateX(-2px);
}

@keyframes spin-quote {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin-animation {
  animation: spin-quote 0.6s linear infinite !important;
}

/* Sidebar User Profile Pill (Bottom of Sidebar) */
.bc-sidebar-user-pill {
  padding: 0.75rem 0.85rem !important;
  margin: 0.5rem 0.75rem 0.75rem !important;
  background-color: var(--bc-surface-muted) !important;
  border: 1px solid var(--bc-border) !important;
  border-radius: var(--bc-radius-lg) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  text-decoration: none !important;
  transition: all var(--bc-transition-fast) !important;
}

.bc-sidebar-user-pill:hover {
  background-color: var(--bc-surface-subtle) !important;
  border-color: var(--bc-border-hover) !important;
}

/* ==========================================================================
   5. CARDS SYSTEM (PRIMARY VISUAL COMPONENT)
   ========================================================================== */
.card, .bc-card {
  background-color: var(--bc-surface) !important;
  border: 1px solid var(--bc-border) !important;
  border-radius: var(--bc-radius-lg) !important;
  box-shadow: var(--bc-shadow-xs) !important;
  transition: box-shadow var(--bc-transition-base), border-color var(--bc-transition-base) !important;
  overflow: hidden;
}

.card:hover, .bc-card:hover {
  box-shadow: var(--bc-shadow-sm) !important;
}

/* Interactive Card Variant */
.card-interactive, .bc-card-interactive {
  cursor: pointer;
  transition: transform var(--bc-transition-fast), box-shadow var(--bc-transition-fast), border-color var(--bc-transition-fast) !important;
}

.card-interactive:hover, .bc-card-interactive:hover {
  transform: translateY(-2px) !important;
  box-shadow: var(--bc-shadow-md) !important;
  border-color: var(--bc-border-hover) !important;
}

.card-header, .bc-card-header {
  background-color: transparent !important;
  border-bottom: 1px solid var(--bc-border) !important;
  padding: 1.15rem 1.35rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

.card-body, .bc-card-body {
  padding: 1.35rem !important;
}

.card-footer, .bc-card-footer {
  background-color: var(--bc-surface-muted) !important;
  border-top: 1px solid var(--bc-border) !important;
  padding: 0.85rem 1.35rem !important;
}

.card-title, .bc-card-title {
  font-size: 1rem !important;
  font-weight: 700 !important;
  color: var(--bc-text-primary) !important;
  margin-bottom: 0 !important;
}

/* ==========================================================================
   6. METRIC & STAT CARDS (REFERENCE IMAGE 1 ARCHITECTURE)
   ========================================================================== */
.bc-stat-card {
  background-color: var(--bc-surface) !important;
  border: 1px solid var(--bc-border) !important;
  border-radius: var(--bc-radius-lg) !important;
  padding: 1.25rem 1.35rem !important;
  box-shadow: var(--bc-shadow-xs) !important;
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  height: 100% !important;
  transition: all var(--bc-transition-base) !important;
}

.bc-stat-card:hover {
  box-shadow: var(--bc-shadow-sm) !important;
  border-color: var(--bc-border-hover) !important;
}

.bc-stat-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}

/* Icon Container - Soft Tinted Circles */
.bc-stat-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.bc-stat-icon-circle.primary {
  background-color: var(--bc-primary-soft);
  color: var(--bc-primary);
}

.bc-stat-icon-circle.purple {
  background-color: var(--bc-purple-soft);
  color: var(--bc-purple);
}

.bc-stat-icon-circle.info {
  background-color: var(--bc-info-soft);
  color: var(--bc-info);
}

.bc-stat-icon-circle.warning {
  background-color: var(--bc-warning-soft);
  color: var(--bc-warning);
}

.bc-stat-icon-circle.success {
  background-color: var(--bc-success-soft);
  color: var(--bc-success);
}

.bc-stat-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--bc-text-muted);
  margin-bottom: 0.15rem;
}

.bc-stat-value-group {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.bc-stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--bc-text-primary);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

/* Trend Pill Badges (↑ 18.2% / ↓ 0.6%) */
.bc-trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--bc-radius-pill);
}

.bc-trend-pill.up {
  color: var(--bc-success-text);
  background-color: var(--bc-success-soft);
}

.bc-trend-pill.down {
  color: var(--bc-danger-text);
  background-color: var(--bc-danger-soft);
}

.bc-stat-subtext {
  font-size: 0.6875rem;
  color: var(--bc-text-dim);
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

/* SVG Sparkline Container */
.bc-stat-sparkline {
  width: 100%;
  height: 38px;
  margin-top: auto;
}

.bc-stat-sparkline path {
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bc-stat-sparkline.primary path { stroke: var(--bc-primary); }
.bc-stat-sparkline.purple path { stroke: var(--bc-purple); }
.bc-stat-sparkline.info path { stroke: var(--bc-info); }
.bc-stat-sparkline.warning path { stroke: var(--bc-warning); }
.bc-stat-sparkline.success path { stroke: var(--bc-success); }

/* ==========================================================================
   7. BUTTON SYSTEM
   ========================================================================== */
.btn {
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  border-radius: var(--bc-radius-md) !important;
  padding: 0.5rem 1rem !important;
  transition: all var(--bc-transition-fast) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.45rem !important;
}

/* Primary Button - Electric Blue */
.btn-primary, .btn-bc-primary {
  background-color: var(--bc-primary) !important;
  border-color: var(--bc-primary) !important;
  color: #FFFFFF !important;
  box-shadow: 0 1px 2px rgba(0, 102, 255, 0.20) !important;
}

.btn-primary:hover, .btn-bc-primary:hover {
  background-color: var(--bc-primary-hover) !important;
  border-color: var(--bc-primary-hover) !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 8px rgba(0, 102, 255, 0.30) !important;
}

.btn-primary:active, .btn-bc-primary:active {
  background-color: var(--bc-primary-active) !important;
  border-color: var(--bc-primary-active) !important;
}

/* Secondary / Light Button */
.btn-secondary, .btn-light, .btn-bc-secondary {
  background-color: var(--bc-surface) !important;
  border: 1px solid var(--bc-border) !important;
  color: var(--bc-text-primary) !important;
  box-shadow: var(--bc-shadow-xs) !important;
}

.btn-secondary:hover, .btn-light:hover, .btn-bc-secondary:hover {
  background-color: var(--bc-surface-muted) !important;
  border-color: var(--bc-border-hover) !important;
  color: var(--bc-primary) !important;
}

/* Outline Primary */
.btn-outline-primary {
  border: 1px solid var(--bc-border) !important;
  color: var(--bc-primary) !important;
  background-color: var(--bc-surface) !important;
}

.btn-outline-primary:hover {
  background-color: var(--bc-primary-soft) !important;
  border-color: var(--bc-primary) !important;
  color: var(--bc-primary) !important;
}

/* Ghost / Subdued Button */
.btn-ghost, .btn-link {
  background: transparent !important;
  border: none !important;
  color: var(--bc-text-secondary) !important;
  box-shadow: none !important;
  text-decoration: none !important;
}

.btn-ghost:hover, .btn-link:hover {
  color: var(--bc-primary) !important;
  background: var(--bc-surface-muted) !important;
}

/* Pill Filter Buttons (e.g. Date Range / Export in Header) */
.bc-header-pill-btn {
  background-color: var(--bc-surface) !important;
  border: 1px solid var(--bc-border) !important;
  border-radius: var(--bc-radius-pill) !important;
  color: var(--bc-text-secondary) !important;
  padding: 0.45rem 1rem !important;
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  box-shadow: var(--bc-shadow-xs) !important;
}

.bc-header-pill-btn:hover {
  border-color: var(--bc-border-hover) !important;
  color: var(--bc-primary) !important;
  background-color: var(--bc-surface-muted) !important;
}

/* Icon Buttons */
.btn-icon, .btn-icon-sm {
  padding: 0 !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: var(--bc-radius-md) !important;
}

.btn-icon-sm {
  width: 30px !important;
  height: 30px !important;
  font-size: 0.8125rem !important;
}

/* ==========================================================================
   8. FORM CONTROLS & INPUTS
   ========================================================================== */
.form-control, .form-select {
  background-color: var(--bc-surface) !important;
  border: 1px solid var(--bc-border) !important;
  border-radius: var(--bc-radius-md) !important;
  color: var(--bc-text-primary) !important;
  padding: 0.55rem 0.85rem !important;
  font-size: 0.875rem !important;
  transition: border-color var(--bc-transition-fast), box-shadow var(--bc-transition-fast) !important;
}

.form-control:focus, .form-select:focus {
  border-color: var(--bc-primary) !important;
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15) !important;
  background-color: var(--bc-surface) !important;
  color: var(--bc-text-primary) !important;
  outline: none !important;
}

.form-control::placeholder {
  color: var(--bc-text-dim) !important;
}

.form-label {
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  color: var(--bc-text-secondary) !important;
  margin-bottom: 0.35rem !important;
}

/* Input group */
.input-group-text {
  background-color: var(--bc-surface-muted) !important;
  border: 1px solid var(--bc-border) !important;
  color: var(--bc-text-muted) !important;
}

/* Checkbox & Radio styling */
.form-check-input {
  border: 1.5px solid var(--bc-border-strong) !important;
  border-radius: var(--bc-radius-xs) !important;
  width: 1.1em !important;
  height: 1.1em !important;
  cursor: pointer;
}

.form-check-input:checked {
  background-color: var(--bc-primary) !important;
  border-color: var(--bc-primary) !important;
}

/* ==========================================================================
   9. TABLES & DATA LISTS
   ========================================================================== */
.table, .bc-table {
  color: var(--bc-text-primary) !important;
  border-color: var(--bc-border) !important;
  margin-bottom: 0 !important;
  vertical-align: middle !important;
}

.table th, .bc-table th {
  background-color: var(--bc-surface-muted) !important;
  color: var(--bc-text-muted) !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  padding: 0.75rem 1rem !important;
  border-bottom: 1px solid var(--bc-border) !important;
  border-top: none !important;
}

.table td, .bc-table td {
  padding: 0.85rem 1rem !important;
  font-size: 0.875rem !important;
  border-bottom: 1px solid var(--bc-border) !important;
  color: var(--bc-text-secondary) !important;
}

.table tr:hover td, .bc-table tr:hover td {
  background-color: var(--bc-surface-muted) !important;
}

/* Table Card Wrapper */
.bc-table-card {
  border-radius: var(--bc-radius-lg) !important;
  overflow: hidden !important;
  border: 1px solid var(--bc-border) !important;
  background-color: var(--bc-surface) !important;
}

/* Top Products / Service Row (Image 1 Architecture) */
.bc-product-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--bc-border);
}

.bc-product-row:last-child {
  border-bottom: none;
}

.bc-product-icon-box {
  width: 36px;
  height: 36px;
  border-radius: var(--bc-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #FFFFFF;
  flex-shrink: 0;
}

.gap-2\.5 {
  gap: 0.75rem !important;
}

/* ==========================================================================
   10. AI RECOMMENDATIONS & CHANNEL PERFORMANCE (IMAGE 1 COMPONENTS)
   ========================================================================== */

/* AI Recommendations Card */
.bc-ai-rec-card {
  background-color: var(--bc-surface);
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-radius-lg);
  padding: 1.25rem 1.35rem;
}

.bc-ai-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--bc-border);
}

.bc-ai-item:last-child {
  border-bottom: none;
}

.bc-ai-icon-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #FFFFFF;
  flex-shrink: 0;
}

/* Channel Performance Progress Bars */
.bc-channel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
}

.bc-progress-track {
  flex: 1 1 auto;
  height: 6px;
  background-color: var(--bc-surface-muted);
  border-radius: var(--bc-radius-pill);
  overflow: hidden;
}

.bc-progress-bar-fill {
  height: 100%;
  background-color: var(--bc-primary);
  border-radius: var(--bc-radius-pill);
  transition: width 0.6s ease;
}

/* ==========================================================================
   11. BADGES & STATUS PILLS
   ========================================================================== */
.badge {
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  padding: 0.25rem 0.65rem !important;
  border-radius: var(--bc-radius-pill) !important;
}

.badge-primary, .badge.bg-primary {
  background-color: var(--bc-primary-soft) !important;
  color: var(--bc-primary) !important;
  border: 1px solid var(--bc-primary-border) !important;
}

.badge-success, .badge.bg-success {
  background-color: var(--bc-success-soft) !important;
  color: var(--bc-success-text) !important;
  border: 1px solid var(--bc-success-border) !important;
}

.badge-warning, .badge.bg-warning {
  background-color: var(--bc-warning-soft) !important;
  color: var(--bc-warning-text) !important;
  border: 1px solid var(--bc-warning-border) !important;
}

.badge-danger, .badge.bg-danger {
  background-color: var(--bc-danger-soft) !important;
  color: var(--bc-danger-text) !important;
  border: 1px solid var(--bc-danger-border) !important;
}

.badge-info, .badge.bg-info {
  background-color: var(--bc-info-soft) !important;
  color: var(--bc-info-text) !important;
  border: 1px solid var(--bc-info-border) !important;
}

/* BETA pill */
.bc-badge-beta {
  background-color: var(--bc-primary-soft) !important;
  color: var(--bc-primary) !important;
  font-size: 0.6875rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em !important;
  padding: 0.15rem 0.5rem !important;
  border-radius: var(--bc-radius-pill) !important;
}

/* Online Pulse Indicator */
.bc-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--bc-success);
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: bcPulse 2s infinite;
}

@keyframes bcPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ==========================================================================
   12. MODALS & DIALOGS
   ========================================================================== */
.modal-content {
  background-color: var(--bc-surface) !important;
  border: 1px solid var(--bc-border) !important;
  border-radius: var(--bc-radius-xl) !important;
  box-shadow: var(--bc-shadow-xl) !important;
}

.modal-header {
  border-bottom: 1px solid var(--bc-border) !important;
  padding: 1.25rem 1.5rem !important;
}

.modal-title {
  font-size: 1.125rem !important;
  font-weight: 700 !important;
  color: var(--bc-text-primary) !important;
}

.modal-body {
  padding: 1.5rem !important;
}

.modal-footer {
  border-top: 1px solid var(--bc-border) !important;
  padding: 1rem 1.5rem !important;
}

/* ==========================================================================
   13. RTL ARABIC SPECIALIZED REFINEMENTS
   ========================================================================== */
[dir="rtl"] {
  text-align: right;
}

/* Sidebar RTL / LTR */
[dir="rtl"] .pe-app-sidebar {
  right: 0 !important;
  left: auto !important;
  border-left: 1px solid var(--bc-border) !important;
  border-right: none !important;
}

[dir="ltr"] .pe-app-sidebar {
  left: 0 !important;
  right: auto !important;
  border-right: 1px solid var(--bc-border) !important;
  border-left: none !important;
}

/* Main Content & Header RTL */
[dir="rtl"] .app-wrapper,
[dir="rtl"] main.app-wrapper {
  margin-right: var(--bc-sidebar-width) !important;
  margin-left: 0 !important;
  width: calc(100% - var(--bc-sidebar-width)) !important;
}

[dir="rtl"] .app-header {
  margin-right: var(--bc-sidebar-width) !important;
  margin-left: 0 !important;
  width: calc(100% - var(--bc-sidebar-width)) !important;
}

[dir="rtl"] footer.footer,
[dir="rtl"] .bc-global-footer {
  margin-right: var(--bc-sidebar-width) !important;
  margin-left: 0 !important;
  width: calc(100% - var(--bc-sidebar-width)) !important;
}

/* Main Content & Header LTR */
[dir="ltr"] .app-wrapper,
[dir="ltr"] main.app-wrapper {
  margin-left: var(--bc-sidebar-width) !important;
  margin-right: 0 !important;
  width: calc(100% - var(--bc-sidebar-width)) !important;
}

[dir="ltr"] .app-header {
  margin-left: var(--bc-sidebar-width) !important;
  margin-right: 0 !important;
  width: calc(100% - var(--bc-sidebar-width)) !important;
}

[dir="ltr"] footer.footer,
[dir="ltr"] .bc-global-footer {
  margin-left: var(--bc-sidebar-width) !important;
  margin-right: 0 !important;
  width: calc(100% - var(--bc-sidebar-width)) !important;
}

/* Collapsed Sidebar State (Desktop) */
html[data-sidebar="icon"] [dir="rtl"] .pe-app-sidebar,
[data-sidebar="icon"] [dir="rtl"] .pe-app-sidebar {
  width: var(--bc-sidebar-collapsed-width, 72px) !important;
}

html[data-sidebar="icon"] [dir="rtl"] .app-wrapper,
html[data-sidebar="icon"] [dir="rtl"] main.app-wrapper,
html[data-sidebar="icon"] [dir="rtl"] .app-header,
html[data-sidebar="icon"] [dir="rtl"] footer.footer,
html[data-sidebar="icon"] [dir="rtl"] .bc-global-footer,
[data-sidebar="icon"] [dir="rtl"] .app-wrapper,
[data-sidebar="icon"] [dir="rtl"] main.app-wrapper,
[data-sidebar="icon"] [dir="rtl"] .app-header,
[data-sidebar="icon"] [dir="rtl"] footer.footer,
[data-sidebar="icon"] [dir="rtl"] .bc-global-footer {
  margin-right: var(--bc-sidebar-collapsed-width, 72px) !important;
  width: calc(100% - var(--bc-sidebar-collapsed-width, 72px)) !important;
}

html[data-sidebar="icon"] [dir="ltr"] .pe-app-sidebar,
[data-sidebar="icon"] [dir="ltr"] .pe-app-sidebar {
  width: var(--bc-sidebar-collapsed-width, 72px) !important;
}

html[data-sidebar="icon"] [dir="ltr"] .app-wrapper,
html[data-sidebar="icon"] [dir="ltr"] main.app-wrapper,
html[data-sidebar="icon"] [dir="ltr"] .app-header,
html[data-sidebar="icon"] [dir="ltr"] footer.footer,
html[data-sidebar="icon"] [dir="ltr"] .bc-global-footer,
[data-sidebar="icon"] [dir="ltr"] .app-wrapper,
[data-sidebar="icon"] [dir="ltr"] main.app-wrapper,
[data-sidebar="icon"] [dir="ltr"] .app-header,
[data-sidebar="icon"] [dir="ltr"] footer.footer,
[data-sidebar="icon"] [dir="ltr"] .bc-global-footer {
  margin-left: var(--bc-sidebar-collapsed-width, 72px) !important;
  width: calc(100% - var(--bc-sidebar-collapsed-width, 72px)) !important;
}

/* Responsive adjustment for Mobile/Tablet */
@media (max-width: 991.98px) {
  [dir="rtl"] .app-wrapper,
  [dir="rtl"] main.app-wrapper,
  [dir="rtl"] .app-header,
  [dir="ltr"] .app-wrapper,
  [dir="ltr"] main.app-wrapper,
  [dir="ltr"] .app-header,
  [dir="rtl"] footer.footer,
  [dir="ltr"] footer.footer,
  [dir="rtl"] .bc-global-footer,
  [dir="ltr"] .bc-global-footer {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
  }

  main.app-wrapper,
  .app-wrapper {
    padding: 1.25rem 1rem 2.5rem 1rem !important;
  }
}

/* ==========================================================================
   14. BULLETPROOF FORM SWITCHES (RTL & LTR)
   Eliminates negative margin overlaps and ensures clean spacing
   ========================================================================== */
.form-check.form-switch {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  padding: 0 !important;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.form-check.form-switch .form-check-input {
  float: none !important;
  margin: 0 !important;
  cursor: pointer;
  width: 2.6em !important;
  height: 1.45em !important;
  flex-shrink: 0 !important;
  border-radius: 2rem !important;
  background-color: #cbd5e1;
  border: 1px solid #94a3b8;
  transition: background-color 0.2s ease, border-color 0.2s ease, background-position 0.2s ease;
}

.form-check.form-switch .form-check-input:checked {
  background-color: var(--bc-primary) !important;
  border-color: var(--bc-primary) !important;
}

.form-check.form-switch .form-check-label {
  margin: 0 !important;
  cursor: pointer;
  user-select: none;
  font-size: 0.875rem;
  line-height: 1.4;
}

[dir="rtl"] .form-check.form-switch {
  text-align: right;
}

[dir="rtl"] .form-check.form-switch .form-check-input {
  margin-left: 0 !important;
  margin-right: 0 !important;
}
