/* ============================================
   Professional Accreditation Certificate System
   Dark/Light Theme with RTL Sidebar Layout
   ============================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Tajawal:wght@300;400;500;700;800&display=swap");

:root {
  --color-input-icon: #111827;
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-glass: rgba(17, 24, 39, 0.6);
  --bg-input: rgba(30, 41, 59, 0.8);
  --border-color: rgba(99, 102, 241, 0.2);
  --border-hover: rgba(99, 102, 241, 0.5);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.3);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.3);
  --info: #06b6d4;
  --info-glow: rgba(6, 182, 212, 0.3);
  --gradient-1: linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-2: linear-gradient(135deg, #06b6d4, #6366f1);
  --gradient-3: linear-gradient(135deg, #10b981, #06b6d4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px var(--accent-glow);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 260px;
  --navbar-height: 65px;
  --body-bg-gradient: radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 50%);
}

/* ═══ Light Theme ═══ */
[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-glass: rgba(255, 255, 255, 0.75);
  --bg-input: rgba(241, 245, 249, 0.9);
  --border-color: rgba(99, 102, 241, 0.15);
  --border-hover: rgba(99, 102, 241, 0.4);
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
  --body-bg-gradient: radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 80%, rgba(6, 182, 212, 0.03) 0%, transparent 50%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Tajawal", "Inter", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: var(--body-bg-gradient);
  pointer-events: none;
  z-index: 0;
  transition: background 0.5s ease;
}

/* ═══════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
}

.login-particles {
  position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0;
}

.particle {
  position: absolute;
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.15;
  animation: floatParticle 20s infinite linear;
}
.particle:nth-child(1) { top: 10%; left: 20%; animation-delay: 0s; animation-duration: 25s; }
.particle:nth-child(2) { top: 60%; left: 80%; animation-delay: -5s; animation-duration: 20s; width: 8px; height: 8px; }
.particle:nth-child(3) { top: 30%; left: 50%; animation-delay: -10s; animation-duration: 30s; width: 4px; height: 4px; }
.particle:nth-child(4) { top: 80%; left: 30%; animation-delay: -3s; animation-duration: 22s; }
.particle:nth-child(5) { top: 45%; left: 70%; animation-delay: -7s; animation-duration: 18s; width: 10px; height: 10px; opacity: 0.08; }
.particle:nth-child(6) { top: 15%; left: 90%; animation-delay: -12s; animation-duration: 28s; width: 5px; height: 5px; }

@keyframes floatParticle {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(100px, -80px) rotate(90deg); }
  50% { transform: translate(-60px, 120px) rotate(180deg); }
  75% { transform: translate(80px, 60px) rotate(270deg); }
}

.login-wrapper {
  position: relative; z-index: 1;
  width: 100%; max-width: 440px; padding: 2rem;
  text-align: center;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(99, 102, 241, 0.1);
  animation: slideInUp 0.5s ease;
}

.login-header { margin-bottom: 2rem; }

.login-logo-icon {
  width: 70px; height: 70px;
  margin: 0 auto 1rem;
  background: var(--gradient-1);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  box-shadow: var(--shadow-glow);
  animation: pulse 3s infinite;
}

.login-header h1 {
  font-size: 1.4rem; font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.login-subtitle { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; font-family: 'Inter', sans-serif; }

.input-icon-wrap {
  color: var(--color-input-icon);
  position: relative; display: flex; align-items: center;
}
.input-icon {
  color: var(--color-input-icon);
  position: absolute; right: 14px; font-size: 1.1rem; z-index: 2; pointer-events: none;
}
.input-with-icon { padding-right: 42px !important; }
.pwd-toggle {
  position: absolute; left: 10px; background: none; border: none;
  cursor: pointer; font-size: 1.1rem; z-index: 2; padding: 4px;
}

.login-error-msg {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.btn-block { width: 100%; justify-content: center; }

.spinner-sm {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

.btn-spinner { display: inline-flex; align-items: center; justify-content: center; }

.login-footer { margin-top: 2rem; }
.login-footer p { color: var(--text-muted); font-size: 0.75rem; }

.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

@keyframes pulse {
  0%, 100% { box-shadow: var(--shadow-glow); }
  50% { box-shadow: 0 0 40px var(--accent-glow), 0 0 60px rgba(99, 102, 241, 0.15); }
}

/* ═══════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════ */
.sidebar {
  position: fixed;
  right: 0; top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  min-height: var(--navbar-height);
}

.sidebar-logo {
  width: 42px; height: 42px;
  background: var(--gradient-1);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.sidebar-brand-text h2 {
  font-size: 1rem; font-weight: 700;
  background: var(--gradient-1);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  white-space: nowrap;
}

.sidebar-brand-text span {
  font-size: 0.65rem; color: var(--text-muted);
  display: block; font-family: 'Inter', sans-serif;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.sidebar-link:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-light);
  font-weight: 700;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  right: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--gradient-1);
  border-radius: 4px 0 0 4px;
}

.sidebar-link-icon { font-size: 1.15rem; width: 28px; text-align: center; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-version { font-size: 0.7rem; color: var(--text-muted); }

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  padding: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.theme-toggle-track {
  width: 44px; height: 24px;
  background: var(--bg-primary);
  border-radius: 100px;
  position: relative;
  transition: var(--transition);
}

.theme-toggle-thumb {
  width: 18px; height: 18px;
  background: var(--gradient-1);
  border-radius: 50%;
  position: absolute;
  top: 3px; right: 3px;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem;
}

[data-theme="light"] .theme-toggle-thumb {
  right: auto; left: 3px;
}

.theme-toggle-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ═══════════════════════════════════════
   TOP NAVBAR
   ═══════════════════════════════════════ */
.top-navbar {
  position: fixed;
  top: 0;
  right: var(--sidebar-width);
  left: 0;
  width: calc(100% - var(--sidebar-width));
  height: var(--navbar-height);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none; border: none; cursor: pointer; padding: 6px;
}
.sidebar-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: var(--transition);
}

.page-title-nav {
  font-size: 1.1rem; font-weight: 700; color: var(--text-primary);
}

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

/* User Dropdown */
.user-dropdown { position: relative; }

.user-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 8px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-primary);
  font-family: inherit;
}

.user-dropdown-btn:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.user-avatar {
  width: 34px; height: 34px;
  background: var(--gradient-1);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; color: white;
  flex-shrink: 0;
}

.user-avatar.lg { width: 42px; height: 42px; font-size: 1.1rem; border-radius: var(--radius-md); }

.user-info-text {
  display: flex; flex-direction: column; align-items: flex-start;
}

.user-name { font-size: 0.85rem; font-weight: 600; }

.user-role-badge {
  font-size: 0.65rem; color: var(--accent-light);
  background: rgba(99, 102, 241, 0.15);
  padding: 1px 8px;
  border-radius: 100px;
}

.dropdown-arrow { font-size: 0.75rem; color: var(--text-muted); transition: var(--transition); }
.user-dropdown.open .dropdown-arrow { transform: rotate(180deg); }

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 260px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition);
  z-index: 300;
  overflow: hidden;
}

.user-dropdown.open .user-dropdown-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}

.dropdown-user-header {
  padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 12px;
}

.dropdown-user-header strong { font-size: 0.9rem; display: block; }
.dropdown-user-header small { font-size: 0.75rem; color: var(--text-muted); direction: ltr; }

.dropdown-divider {
  height: 1px; background: var(--border-color); margin: 0;
}

.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 1.25rem;
  background: none; border: none;
  color: var(--text-secondary);
  font-size: 0.85rem; font-family: inherit;
  cursor: pointer; transition: var(--transition);
  text-align: right;
}

.dropdown-item:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text-primary);
}

.dropdown-item-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* ═══════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════ */
.app-body { overflow-x: hidden; }

.app-content {
  margin-right: var(--sidebar-width);
  padding-top: var(--navbar-height);
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.content-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 190;
}

/* ═══════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: calc(var(--navbar-height) + 16px);
  left: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.4s ease;
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.toast::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  animation: toastTimer 5s linear forwards;
}

.toast-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
}
.toast-success::after { background: var(--success); }

.toast-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}
.toast-error::after { background: var(--danger); }

.toast-warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--warning);
}
.toast-warning::after { background: var(--warning); }

.toast-info {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--info);
}
.toast-info::after { background: var(--info); }

.toast-icon { font-size: 1.3rem; flex-shrink: 0; }
.toast-close {
  margin-right: auto; background: none; border: none;
  color: inherit; cursor: pointer; font-size: 1.2rem;
  opacity: 0.6; padding: 0 4px;
}
.toast-close:hover { opacity: 1; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); max-height: 100px; }
  to { opacity: 0; transform: translateX(40px); max-height: 0; padding: 0; margin: 0; }
}
@keyframes toastTimer {
  from { width: 100%; }
  to { width: 0%; }
}

/* ═══════════════════════════════════════
   CONFIRM DIALOG
   ═══════════════════════════════════════ */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.confirm-overlay.active { display: flex; }

.confirm-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
  animation: slideInUp 0.3s ease;
}

.confirm-icon { font-size: 3rem; margin-bottom: 1rem; }
.confirm-box h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.confirm-box p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1.5rem; line-height: 1.6; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ═══════════════════════════════════════
   QUICK ACTIONS (Dashboard)
   ═══════════════════════════════════════ */
.quick-actions {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 1rem;
}

.quick-action-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 0.9rem; font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
}

.quick-action-btn.primary {
  background: var(--gradient-1);
  color: white;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.quick-action-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px var(--accent-glow);
}

.quick-action-btn.outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.quick-action-btn.outline:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: rgba(99, 102, 241, 0.05);
}

.quick-action-icon { font-size: 1.1rem; }

/* ═══════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════ */
.page-header { margin-bottom: 2rem; }
.page-header h2 { font-size: 1.8rem; font-weight: 800; margin-bottom: 0.5rem; }
.page-header p { color: var(--text-secondary); font-size: 1rem; }

/* ═══════════════════════════════════════
   STATS CARDS
   ═══════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 0 0 0 50%;
  opacity: 0.1;
}

.stat-card:nth-child(1)::before { background: var(--accent); }
.stat-card:nth-child(2)::before { background: var(--success); }
.stat-card:nth-child(3)::before { background: var(--warning); }
.stat-card:nth-child(4)::before { background: var(--info); }

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.stat-card .stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.stat-card:nth-child(1) .stat-icon { background: rgba(99, 102, 241, 0.15); color: var(--accent-light); }
.stat-card:nth-child(2) .stat-icon { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.stat-card:nth-child(3) .stat-icon { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.stat-card:nth-child(4) .stat-icon { background: rgba(6, 182, 212, 0.15); color: var(--info); }

.stat-card .stat-value { font-size: 2rem; font-weight: 800; margin-bottom: 0.25rem; }
.stat-card .stat-label { font-size: 0.85rem; color: var(--text-secondary); }

/* ═══════════════════════════════════════
   CARDS
   ═══════════════════════════════════════ */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
}
.card:hover { border-color: var(--border-hover); }

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 {
  font-size: 1.1rem; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.card-body { padding: 1.5rem; }

/* ═══════════════════════════════════════
   TABLES
   ═══════════════════════════════════════ */
.table {
  width: 100%; border-collapse: separate; border-spacing: 0; background: transparent;
}
.table th {
  padding: 12px 14px; text-align: right;
  font-size: 0.85rem; font-weight: 700; color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  background: rgba(30, 41, 59, 0.35);
  white-space: nowrap;
}
.table td {
  padding: 12px 14px; font-size: 0.9rem;
  border-bottom: 1px solid rgba(99, 102, 241, 0.06);
}
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: rgba(99, 102, 241, 0.04); }

.table-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.table-search { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.table-search input { width: 100%; max-width: 400px; }

.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.pagination .page-btn {
  padding: 6px 10px; border-radius: 8px;
  background: transparent; border: 1px solid var(--border-color);
  color: var(--text-primary); cursor: pointer;
}
.pagination .page-btn.active {
  background: var(--accent); color: white;
  box-shadow: var(--shadow-glow); border-color: var(--accent);
}
.pagination .page-info { color: var(--text-secondary); margin-right: auto; }
.no-results { padding: 1rem; color: var(--text-secondary); }

/* ═══════════════════════════════════════
   BADGES
   ═══════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 100px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.badge-success { background: rgba(16, 185, 129, 0.12); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-danger { background: rgba(239, 68, 68, 0.12); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-info { background: rgba(6, 182, 212, 0.12); color: var(--info); border: 1px solid rgba(6, 182, 212, 0.2); }
.badge-neutral { background: rgba(100, 116, 139, 0.12); color: var(--text-secondary); border: 1px solid rgba(100, 116, 139, 0.2); }

/* ═══════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-md);
  font-size: 0.9rem; font-weight: 600; text-decoration: none;
  border: none; cursor: pointer; transition: var(--transition);
  font-family: inherit; white-space: nowrap;
}
.btn-primary {
  background: var(--gradient-1); color: white;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 24px var(--accent-glow); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: white; box-shadow: 0 4px 14px var(--success-glow); }
.btn-success:hover { transform: translateY(-2px); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.btn-danger:hover { transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-light); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 32px; font-size: 1rem; border-radius: var(--radius-md); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn-group { display: flex; gap: 8px; }

/* ═══════════════════════════════════════
   FORMS
   ═══════════════════════════════════════ */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-label .required { color: var(--danger); margin-right: 2px; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; display: block; }

.form-control {
  width: 100%; padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem; font-family: inherit;
  transition: var(--transition);
  direction: rtl;
}
.form-control:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 36px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* ═══════════════════════════════════════
   MODALS
   ═══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  z-index: 9000;
}
.modal-overlay.active { display: flex; }

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  max-width: 500px; width: 90%;
  padding: 0;
  animation: slideInUp 0.3s ease;
  overflow: hidden;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.5rem; cursor: pointer; padding: 4px 8px;
  border-radius: var(--radius-sm); transition: var(--transition);
}
.modal-close:hover { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.modal-content .form-group,
.modal-content .modal-actions { padding: 0 1.5rem; }
.modal-content .form-group:first-of-type { padding-top: 1.5rem; }
.modal-actions {
  display: flex; gap: 10px;
  padding: 1.25rem 1.5rem !important;
  justify-content: flex-start;
}

/* ═══════════════════════════════════════
   LOADING & ALERTS
   ═══════════════════════════════════════ */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  z-index: 9999;
  flex-direction: column; gap: 1.5rem;
}
.loading-overlay.active { display: flex; }

.spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text { font-size: 1rem; color: var(--text-secondary); }

.alert {
  padding: 1rem 1.25rem; border-radius: var(--radius-md);
  margin-bottom: 1rem; display: flex; align-items: flex-start;
  gap: 10px; font-size: 0.9rem; animation: slideInUp 0.3s ease;
}
.alert-success { background: rgba(16, 185, 129, 0.08); border: 1px solid rgba(16, 185, 129, 0.2); color: var(--success); }
.alert-danger { background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.2); color: var(--danger); }
.alert-warning { background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.2); color: var(--warning); }
.alert-info { background: rgba(6, 182, 212, 0.08); border: 1px solid rgba(6, 182, 212, 0.2); color: var(--info); }

.empty-state { text-align: center; padding: 4rem 2rem; }
.empty-state .icon { font-size: 3.5rem; margin-bottom: 1rem; opacity: 0.3; }
.empty-state h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.5rem; }
.empty-state p { color: var(--text-secondary); margin-bottom: 1.5rem; }

/* ═══════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.animate-in { animation: slideInUp 0.4s ease; }

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.active { display: block; }
  .top-navbar { right: 0; left: 0; width: 100%; }
  .app-content { margin-right: 0; }
  .sidebar-toggle { display: flex; }
  .toast-container { right: 10px; left: 10px; max-width: none; }
}

@media (max-width: 768px) {
  .content-wrapper { padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .quick-actions { flex-direction: column; }
  .user-info-text { display: none; }
  .page-title-nav { font-size: 0.95rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .table-actions { flex-direction: column; gap: 4px; }
}

/* ═══════════════════════════════════════
   PRINT
   ═══════════════════════════════════════ */
@media print {
  * { color-adjust: exact !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: white !important; color: #1a1a1a !important; }
  body::before { display: none; }
  .sidebar, .top-navbar, .no-print, .loading-overlay, .toast-container,
  .confirm-overlay, .modal-overlay, .sidebar-overlay { display: none !important; }
  .app-content { margin-right: 0; margin-left: 0; padding-top: 0; }
  .content-wrapper { max-width: 100%; padding: 0; margin: 0; }
}
