@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&family=Outfit:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --bg-main: #0B0F19;
  --bg-sidebar: #060913;
  --bg-card: rgba(17, 24, 39, 0.78);
  --bg-card-hover: rgba(26, 36, 60, 0.88);
  --bg-input: rgba(11, 17, 32, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(59, 130, 246, 0.35);
  
  --primary: #3B82F6;
  --primary-glow: rgba(59, 130, 246, 0.5);
  --primary-dark: #1D4ED8;
  --primary-light: #60A5FA;
  
  --secondary: #6366F1;
  --secondary-glow: rgba(99, 102, 241, 0.4);
  
  --success: #10B981;
  --success-glow: rgba(16, 185, 129, 0.35);
  --danger: #EF4444;
  --danger-glow: rgba(239, 68, 68, 0.35);
  --warning: #F59E0B;
  --info: #06B6D4;
  
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  
  --font-arabic: 'Cairo', system-ui, -apple-system, sans-serif;
  --font-numeric: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] {
  --bg-main: #F8FAFC;
  --bg-sidebar: #FFFFFF;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-hover: #FFFFFF;
  --bg-input: #F1F5F9;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-glow: rgba(59, 130, 246, 0.25);
  --text-main: #0F172A;
  --text-muted: #475569;
  --text-dim: #94A3B8;
  --shadow-card: 0 8px 25px -5px rgba(0, 0, 0, 0.06);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-arabic);
}

body {
  background: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  direction: rtl;
  display: flex;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 15%, rgba(59, 130, 246, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 90% 85%, rgba(99, 102, 241, 0.08) 0%, transparent 45%);
  background-attachment: fixed;
}

/* Layout & Sidebar */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  flex-shrink: 0;
  z-index: 50;
  transition: var(--transition);
}

.sidebar-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  padding-bottom: 14px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 6px;
}

.sidebar-close-btn {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-close-btn:hover {
  color: var(--text-main);
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.12);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 140;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  box-shadow: 0 8px 20px var(--primary-glow);
}

.logo-text h2 {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.4px;
  background: linear-gradient(135deg, #fff 40%, #94A3B8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-section-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 14px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 700;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
}

.nav-item i {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
  transition: transform 0.2s ease;
}

.nav-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-item:hover i {
  transform: scale(1.15);
  color: var(--primary);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(99, 102, 241, 0.08));
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 4px 18px rgba(59, 130, 246, 0.12);
}

.nav-item.active i {
  color: var(--primary-light);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  right: 0;
  top: 15%;
  bottom: 15%;
  width: 4px;
  background: var(--primary);
  border-radius: 4px 0 0 4px;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  color: var(--text-main);
  border-color: var(--primary);
}

.platform-status-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
}

.status-indicator-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.status-indicator-dot.online { background: #10B981; box-shadow: 0 0 8px #10B981; }

/* Main Wrapper */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 36px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(11, 15, 25, 0.75);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.page-title h1 {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -0.3px;
}

.page-title p {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 4px 6px 4px 12px;
}

.user-role-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-main);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #F87171;
  font-size: 0.76rem;
  font-weight: 800;
  text-decoration: none;
  transition: var(--transition);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.28);
  border-color: #EF4444;
  color: #FFFFFF;
}

.pulse-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  border: 1px solid transparent;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

.pulse-dot::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: inherit;
  opacity: 0.6;
  animation: pulseAnim 2s infinite;
}

@keyframes pulseAnim {
  0% { transform: scale(1); opacity: 0.8; }
  70% { transform: scale(2.5); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

.pulse-ready {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.3);
  color: #38BDF8;
}
.pulse-ready .pulse-dot { background: #06B6D4; }

.pulse-running {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34D399;
}
.pulse-running .pulse-dot { background: #10B981; }

.content-body {
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Stats Metric KPI Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--stat-color, var(--primary)), transparent);
  opacity: 0;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--stat-color, var(--primary));
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.3);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  background: var(--stat-bg, rgba(59, 130, 246, 0.15));
  border: 1px solid var(--stat-color, var(--primary));
  flex-shrink: 0;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: var(--font-numeric);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.05;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Glass Cards & Sections */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
}

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

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 800;
}

.card-title i {
  color: var(--primary);
}

/* Live Progress Section */
.progress-card {
  background: linear-gradient(135deg, rgba(18, 24, 38, 0.95), rgba(30, 41, 59, 0.85));
  border: 1px solid rgba(59, 130, 246, 0.3);
  box-shadow: 0 10px 35px rgba(59, 130, 246, 0.08);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.progress-percentage {
  font-family: var(--font-numeric);
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--primary-light);
  letter-spacing: -0.5px;
}

.progress-track {
  width: 100%;
  height: 16px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 999px;
  padding: 3px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--success));
  border-radius: 999px;
  transition: width 0.35s ease;
  box-shadow: 0 0 16px var(--primary-glow);
  position: relative;
}

.progress-fill.active::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

.progress-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  outline: none;
  text-decoration: none;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px var(--primary-glow);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #B91C1C);
  color: #fff;
  box-shadow: 0 6px 20px var(--danger-glow);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px var(--danger-glow);
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning), #D97706);
  color: #fff;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(245, 158, 11, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #047857);
  color: #fff;
  box-shadow: 0 6px 20px var(--success-glow);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px var(--success-glow);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.84rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

/* Dashboard Workspace Split Grid */
.dashboard-workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: stretch;
}

.dashboard-workspace-col {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.dashboard-workspace-col > .glass-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.dashboard-workspace-col .terminal-window {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.dashboard-workspace-col .terminal-body {
  flex: 1;
  min-height: 340px;
  max-height: 440px;
}

.dashboard-workspace-col .form-textarea {
  flex: 1;
  min-height: 280px;
  max-height: 360px;
}

@media (max-width: 1150px) {
  .dashboard-workspace-grid {
    grid-template-columns: 1fr;
  }
}

.bottom-control-bar {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(26, 36, 60, 0.95));
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius-lg);
  padding: 18px 26px;
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45), 0 0 20px rgba(59, 130, 246, 0.12);
}

[data-theme="light"] .bottom-control-bar {
  background: linear-gradient(135deg, #FFFFFF, #F1F5F9);
  border: 1px solid rgba(59, 130, 246, 0.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.btn-action-start {
  padding: 13px 36px;
  font-size: 1.05rem;
  font-weight: 800;
  box-shadow: 0 0 25px var(--primary-glow);
  white-space: nowrap;
}

.btn-action-stop {
  padding: 13px 26px;
  font-weight: 800;
  font-size: 0.98rem;
  white-space: nowrap;
}

.btn-action-retry {
  padding: 13px 24px;
  font-weight: 800;
  font-size: 0.98rem;
  white-space: nowrap;
}

/* Terminal Live Feed Console */
.terminal-window {
  background: #040711;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.terminal-header {
  background: #080C1A;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-red { background: #FF5F56; }
.dot-yellow { background: #FFBD2E; }
.dot-green { background: #27C93F; }

.terminal-body {
  overflow-y: auto;
  padding: 18px 22px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.8;
  display: flex;
  flex-direction: column;
  gap: 6px;
  direction: rtl;
}

.log-line {
  display: flex;
  gap: 12px;
  word-break: break-all;
  animation: fadeInLog 0.2s ease;
}

@keyframes fadeInLog {
  from { opacity: 0; transform: translateX(6px); }
  to { opacity: 1; transform: translateX(0); }
}

.log-time {
  color: var(--text-dim);
  font-family: var(--font-numeric);
  flex-shrink: 0;
}

.log-text {
  flex: 1;
}

.log-type-error { color: #F87171; }
.log-type-success { color: #34D399; font-weight: 600; }
.log-type-attended { color: #38BDF8; font-weight: 800; text-shadow: 0 0 10px rgba(56, 189, 248, 0.4); }
.log-type-warn { color: #FBBF24; }
.log-type-info { color: #94A3B8; }
.log-type-start, .log-type-complete { color: #60A5FA; font-weight: 800; }

/* Session Cards Grid */
.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.session-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition);
}

.session-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 12px 30px rgba(59, 130, 246, 0.12);
}

.empty-state-card {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-card);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
}

/* Groups & Tabs Pill Selector */
.group-tabs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.group-tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.group-tab-pill:hover {
  color: var(--text-main);
  border-color: var(--primary-light);
}

.group-tab-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 16px var(--primary-glow);
}

/* Forms, Inputs & Textarea */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.form-label {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-muted);
}

.form-input, .form-textarea, .form-select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 0.92rem;
  outline: none;
  transition: var(--transition);
}

.form-select-sm {
  padding: 6px 12px;
  font-size: 0.84rem;
}

.form-textarea {
  font-family: var(--font-mono);
  resize: vertical;
  min-height: 240px;
  line-height: 1.7;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

/* Table & Results View */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
}

.custom-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 14px 18px;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.custom-table td {
  padding: 14px 18px;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.custom-table tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
}

.badge-attended, .badge-blue {
  background: rgba(37, 99, 235, 0.22);
  color: #38BDF8;
  border: 1px solid #3B82F6;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.35);
  font-weight: 800;
}

[data-theme="light"] .badge-attended,
[data-theme="light"] .badge-blue {
  background: rgba(37, 99, 235, 0.12);
  color: #1D4ED8;
  border-color: #2563EB;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.2);
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #34D399; border: 1px solid rgba(16, 185, 129, 0.35); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #F87171; border: 1px solid rgba(239, 68, 68, 0.35); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: #60A5FA; border: 1px solid rgba(59, 130, 246, 0.35); }
.badge-warn { background: rgba(245, 158, 11, 0.15); color: #FBBF24; border: 1px solid rgba(245, 158, 11, 0.35); }
.badge-secondary { background: rgba(148, 163, 184, 0.12); color: var(--text-muted); border: 1px solid rgba(148, 163, 184, 0.25); }

.badge-live-active {
  background: rgba(239, 68, 68, 0.2);
  color: #F87171;
  border: 1px solid #EF4444;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.45);
  animation: pulseLiveStream 1.5s infinite;
}

.badge-live-stopped {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-dim);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

@keyframes pulseLiveStream {
  0% { transform: scale(1); opacity: 1; box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }
  50% { transform: scale(1.04); opacity: 0.85; box-shadow: 0 0 18px rgba(239, 68, 68, 0.7); }
  100% { transform: scale(1); opacity: 1; box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }
}

/* Toast Notifications Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: #0F172A;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Tab Views */
.tab-content {
  display: none;
}
.tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.15);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ══════════════════════════════════════════════════════════════ */
/*  Mobile App Bar, Drawer, Bottom Nav & Responsive Styles        */
/* ══════════════════════════════════════════════════════════════ */

/* Mobile Topbar - Hidden on Desktop */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.mobile-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.mobile-menu-btn:active {
  transform: scale(0.92);
  border-color: var(--primary);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px var(--primary-glow);
}

.mobile-brand-title {
  display: flex;
  flex-direction: column;
}

.mobile-brand-title span {
  font-weight: 900;
  font-size: 0.96rem;
  color: var(--text-main);
  line-height: 1.2;
}

.mobile-brand-title small {
  font-size: 0.72rem;
  color: var(--primary-light);
  font-weight: 700;
}

.mobile-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-action-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.mobile-action-icon-btn:active {
  transform: scale(0.92);
}

.mobile-logout-btn {
  color: #F87171;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

.pulse-indicator-mobile {
  padding: 5px 10px;
  font-size: 0.75rem;
}

/* Mobile Quick Actions Bar */
.mobile-quick-actions-bar {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(65px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-subtle);
  z-index: 95;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 100%;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item i {
  width: 22px;
  height: 22px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

.bottom-nav-item:active i {
  transform: scale(0.82);
}

.bottom-nav-item.active {
  color: var(--primary-light);
}

.bottom-nav-item.active i {
  transform: translateY(-2px);
  color: var(--primary);
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.bottom-nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 0 0 6px 6px;
  box-shadow: 0 0 12px var(--primary-glow);
}

/* ══════════════════════════════════════════════════════════════ */
/*  Responsive Breakpoints                                        */
/* ══════════════════════════════════════════════════════════════ */

@media (max-width: 960px) {
  body {
    overflow-x: hidden;
  }

  .app-container {
    flex-direction: column;
  }

  /* Off-canvas Sidebar Drawer */
  .sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 290px;
    height: 100vh;
    height: 100dvh;
    z-index: 150;
    box-shadow: -15px 0 50px rgba(0, 0, 0, 0.75);
    transition: right 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
  }

  .sidebar.open {
    right: 0;
  }

  .sidebar-close-btn {
    display: inline-flex !important;
  }

  .mobile-topbar {
    display: flex !important;
  }

  .mobile-bottom-nav {
    display: flex !important;
  }

  .mobile-quick-actions-bar {
    display: flex !important;
  }

  .main-wrapper {
    padding: 14px 14px calc(80px + env(safe-area-inset-bottom)) 14px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Condense desktop topbar on mobile */
  .topbar {
    padding: 12px 14px;
    margin-bottom: 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .topbar .page-title h1 {
    font-size: 1.2rem;
  }

  .topbar .page-title p {
    font-size: 0.8rem;
  }

  .topbar-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .topbar-actions .btn {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
    padding: 8px 12px;
    font-size: 0.82rem;
  }

  .user-profile-widget {
    display: none;
  }

  .topbar #systemStatusBadge {
    display: none;
  }

  /* Stats Grid on Tablets & Phones */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 14px 12px;
    gap: 10px;
    border-radius: var(--radius-md);
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1.15rem;
    border-radius: var(--radius-sm);
  }

  .stat-value {
    font-size: 1.35rem;
  }

  .stat-label {
    font-size: 0.74rem;
  }

  /* Bottom Control Bar on Mobile */
  .bottom-control-bar {
    padding: 14px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .group-select-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .control-banner-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .control-banner-actions .btn,
  .btn-action-start,
  .btn-action-stop,
  .btn-action-retry {
    width: 100% !important;
    padding: 9px 14px !important;
    font-size: 0.90rem !important;
    font-weight: 800 !important;
    min-height: 42px !important;
    height: 42px !important;
    white-space: nowrap !important;
    justify-content: center !important;
    border-radius: var(--radius-md) !important;
    box-sizing: border-box !important;
  }

  .btn-action-start i,
  .btn-action-stop i,
  .btn-action-retry i {
    width: 18px !important;
    height: 18px !important;
  }

  /* Workspace Grid on Mobile (Students Form + Terminal) */
  .dashboard-workspace-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .terminal-body {
    min-height: 240px;
    max-height: 320px;
    font-size: 0.78rem;
    padding: 12px 10px;
  }

  .form-textarea {
    min-height: 180px;
    font-size: 0.86rem;
  }

  /* Toast Notification Placement on Mobile */
  .toast-container {
    bottom: calc(75px + env(safe-area-inset-bottom));
    left: 14px;
    right: 14px;
    width: auto;
  }

  .toast {
    padding: 12px 16px;
    font-size: 0.86rem;
  }

  /* Sessions Grid */
  .sessions-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .session-card {
    padding: 16px 14px;
  }
}

@media (max-width: 540px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .stat-card {
    padding: 12px 10px;
  }
  .stat-value {
    font-size: 1.22rem;
  }
  .stat-label {
    font-size: 0.68rem;
  }
  .progress-card {
    padding: 16px 14px;
  }
  .progress-percentage {
    font-size: 1.5rem;
  }
}

@media (max-width: 360px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

