/* ===========================
   المكتبة الإلكترونية - التصميم الموحد
   Electronic Library - Unified Design System
   =========================== */

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

/* ===== CSS Variables ===== */
:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --secondary: #8b5cf6;
  --accent: #06b6d4;
  --accent-light: #22d3ee;
  --success: #10b981;
  --success-light: #34d399;
  --warning: #f59e0b;
  --warning-light: #fbbf24;
  --danger: #ef4444;
  --danger-light: #f87171;
  --info: #3b82f6;

  --bg-dark: #0a0a1a;
  --bg-card: #0f0f23;
  --bg-sidebar: #0c0c1d;
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.07);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-hover: rgba(255, 255, 255, 0.15);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #818cf8;

  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-accent: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  --gradient-bg: linear-gradient(135deg, #0a0a1a 0%, #1a1a2e 50%, #0f0f23 100%);
  --gradient-hero: linear-gradient(135deg, rgba(99,102,241,0.15) 0%, rgba(139,92,246,0.1) 50%, rgba(6,182,212,0.05) 100%);

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);
  --shadow-glow-accent: 0 0 30px rgba(6, 182, 212, 0.3);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-width: 280px;
  --sidebar-collapsed: 80px;
  --navbar-height: 70px;

  --font-ar: 'Tajawal', sans-serif;
  --font-en: 'Inter', sans-serif;
}

/* ===== Light Theme Variables ===== */
html.theme-light {
  --bg-dark: #eef2ff;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.96);
  --bg-glass-hover: #ffffff;
  --border-glass: rgba(99, 102, 241, 0.18);
  --border-glass-hover: rgba(99, 102, 241, 0.36);

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;
  --text-accent: #4f46e5;

  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 28px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 16px 50px rgba(15, 23, 42, 0.16);
  --shadow-glow: 0 10px 30px rgba(99, 102, 241, 0.18);

  --gradient-bg: linear-gradient(135deg, #eef2ff 0%, #f8fafc 45%, #e0f2fe 100%);
  --gradient-hero: linear-gradient(135deg, rgba(99,102,241,0.05) 0%, rgba(139,92,246,0.03) 50%, rgba(6,182,212,0.02) 100%);
}

html.theme-light body::before {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139,92,246,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(6,182,212,0.02) 0%, transparent 50%);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ar);
  background: var(--gradient-bg);
  color: var(--text-primary);
  min-height: 100vh;
  direction: rtl;
  overflow-x: hidden;
  line-height: 1.7;
  font-size: 15px;
}

/* Background animated particles */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139,92,246,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(6,182,212,0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: var(--transition);
}
a:hover { color: var(--accent-light); }

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.4;
}

img { max-width: 100%; height: auto; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }

/* ===== Glass Card ===== */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

html.theme-light .glass-card,
html.theme-light .kpi-card,
html.theme-light .book-card {
  box-shadow: var(--shadow-sm);
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.glass-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ===== KPI Cards ===== */
.kpi-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(99,102,241,0.08) 0%, transparent 60%);
  transition: var(--transition-slow);
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
  border-color: rgba(99,102,241,0.3);
}

.kpi-card:hover::after {
  top: -30%;
  right: -30%;
}

.kpi-card .kpi-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.kpi-card .kpi-value {
  font-size: 32px;
  font-weight: 800;
  font-family: var(--font-en);
  color: var(--text-primary);
  position: relative;
  z-index: 1;
}

.kpi-card .kpi-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

.kpi-card .kpi-change {
  font-size: 13px;
  font-family: var(--font-en);
  margin-top: 8px;
  position: relative;
  z-index: 1;
}

.kpi-card .kpi-change.up { color: var(--success); }
.kpi-card .kpi-change.down { color: var(--danger); }

/* ===== Premium Buttons ===== */
.btn-premium {
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-ar);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  justify-content: center;
  min-height: 38px;
}

.btn-premium::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: 0.5s;
}

.btn-premium:hover::before {
  left: 100%;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff !important;
  box-shadow: 0 4px 15px rgba(99,102,241,0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(99,102,241,0.4); }

.btn-accent {
  background: var(--gradient-accent);
  color: #fff !important;
  box-shadow: 0 4px 15px rgba(6,182,212,0.3);
}
.btn-accent:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(6,182,212,0.4); }

.btn-success {
  background: var(--gradient-success);
  color: #fff !important;
  box-shadow: 0 4px 15px rgba(16,185,129,0.3);
}

.btn-danger-solid {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff !important;
  box-shadow: 0 4px 15px rgba(239,68,68,0.3);
}

.btn-glass {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  backdrop-filter: blur(10px);
}
.btn-glass:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-hover);
}

html.theme-light .btn-glass {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #1e293b;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

html.theme-light .btn-glass:hover {
  background: #eef2ff;
  border-color: var(--primary);
  color: var(--primary-dark);
}

.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 32px; font-size: 16px; border-radius: var(--radius-lg); }

/* ===== Form Controls ===== */
.form-glass {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ar);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

html.theme-light .form-glass,
html.theme-light .search-box input {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

html.theme-light .form-glass:focus,
html.theme-light .search-box input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

.form-glass:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
  background: rgba(255,255,255,0.05);
}

.form-glass::placeholder {
  color: var(--text-muted);
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 14px;
}

select.form-glass {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 32px;
}

textarea.form-glass {
  resize: vertical;
  min-height: 100px;
}

/* ===== Data Tables ===== */
.table-glass {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-glass thead th {
  background: rgba(99,102,241,0.12);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 13px;
  padding: 14px 16px;
  text-align: right;
  border-bottom: 1px solid var(--border-glass);
  white-space: nowrap;
}

.table-glass thead th:first-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.table-glass thead th:last-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.table-glass tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-glass);
  font-size: 14px;
  vertical-align: middle;
  color: var(--text-primary);
}

.table-glass tbody tr {
  transition: var(--transition);
}

.table-glass tbody tr:hover {
  background: rgba(99,102,241,0.05);
}

html.theme-light .table-glass thead th {
  background: #e0e7ff;
  color: #1e1b4b;
  border-bottom-color: #c7d2fe;
}

html.theme-light .table-glass tbody tr:hover {
  background: #f1f5ff;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-glass tbody tr:last-child td {
  border-bottom: none;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
}

.pagination .page-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-en);
  font-size: 14px;
}

.pagination .page-btn:hover,
.pagination .page-btn.active {
  background: var(--gradient-primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-primary { background: rgba(99,102,241,0.15); color: var(--primary-light); }
.badge-success { background: rgba(16,185,129,0.15); color: var(--success-light); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning-light); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger-light); }
.badge-info { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-accent { background: rgba(6,182,212,0.15); color: var(--accent-light); }

html.theme-light .badge-primary { background: #e0e7ff; color: #4338ca; }
html.theme-light .badge-success { background: #dcfce7; color: #047857; }
html.theme-light .badge-warning { background: #fef3c7; color: #b45309; }
html.theme-light .badge-danger { background: #fee2e2; color: #b91c1c; }
html.theme-light .badge-info { background: #dbeafe; color: #1d4ed8; }
html.theme-light .badge-accent { background: #cffafe; color: #0e7490; }

/* ===== Alerts / Notifications ===== */
.alert-glass {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  animation: slideInDown 0.3s ease;
}

.alert-success {
  background: rgba(16,185,129,0.1);
  border-color: rgba(16,185,129,0.2);
  color: var(--success-light);
}

.alert-danger {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.2);
  color: var(--danger-light);
}

.alert-warning {
  background: rgba(245,158,11,0.1);
  border-color: rgba(245,158,11,0.2);
  color: var(--warning-light);
}

.alert-info {
  background: rgba(59,130,246,0.1);
  border-color: rgba(59,130,246,0.2);
  color: #60a5fa;
}

/* ===== Modals ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  animation: scaleIn 0.3s ease;
  position: relative;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
  font-size: 20px;
  color: var(--text-primary);
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 18px;
}

.modal-close:hover {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  border-color: rgba(239,68,68,0.3);
}

/* ===== Search Bar ===== */
.search-box {
  position: relative;
  max-width: 400px;
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-family: var(--font-ar);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.search-box .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h4 {
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

/* ===== Loading Spinner ===== */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-glass);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ===== Page Header ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header .breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.page-header .breadcrumb a {
  color: var(--text-muted);
}

.page-header .breadcrumb a:hover {
  color: var(--primary-light);
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ar);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

html.theme-light .tabs {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

html.theme-light .tab-btn {
  color: #334155;
}

html.theme-light .tab-btn:hover {
  background: #eef2ff;
  color: #312e81;
}

.tab-btn.active {
  background: var(--gradient-primary);
  color: #fff;
}

/* ===== Book Card ===== */
.book-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

.book-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-glow);
  border-color: rgba(99,102,241,0.3);
}

.book-card .book-cover {
  width: 100%;
  height: 240px;
  object-fit: cover;
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(139,92,246,0.2));
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-card .book-cover i {
  font-size: 48px;
  color: var(--primary-light);
  opacity: 0.5;
}

.book-card .book-info {
  padding: 16px;
}

.book-card .book-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card .book-author {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.book-card .book-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}

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

@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(99,102,241,0.2); }
  50% { box-shadow: 0 0 40px rgba(99,102,241,0.4); }
}

.animate-fade-in { animation: fadeIn 0.5s ease; }
.animate-fade-up { animation: fadeInUp 0.5s ease; }
.animate-slide-right { animation: slideInRight 0.5s ease; }
.animate-scale { animation: scaleIn 0.3s ease; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-glow { animation: glow 2s ease-in-out infinite; }

.delay-1 { animation-delay: 0.1s; animation-fill-mode: both; }
.delay-2 { animation-delay: 0.2s; animation-fill-mode: both; }
.delay-3 { animation-delay: 0.3s; animation-fill-mode: both; }
.delay-4 { animation-delay: 0.4s; animation-fill-mode: both; }
.delay-5 { animation-delay: 0.5s; animation-fill-mode: both; }

/* ===== Utility Classes ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-primary { color: var(--primary-light) !important; }
.text-success { color: var(--success-light) !important; }
.text-danger { color: var(--danger-light) !important; }
.text-warning { color: var(--warning-light) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--accent-light) !important; }
.fw-bold { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fs-sm { font-size: 13px; }
.fs-lg { font-size: 18px; }
.fs-xl { font-size: 24px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.d-flex { display: flex; }
.d-grid { display: grid; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4, .grid-6 { grid-template-columns: repeat(2, 1fr); }
  .page-header h1 { font-size: 22px; }
  .kpi-card .kpi-value { font-size: 24px; }
  .hide-mobile { display: none !important; }
}

@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4, .grid-6 { grid-template-columns: 1fr; }
}

/* ===== Tooltip ===== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 100%;
  right: 50%;
  transform: translateX(50%);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  z-index: 1000;
}

[data-tooltip]:hover::after {
  opacity: 1;
  top: calc(100% + 8px);
}

/* ===== Toggle Switch ===== */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  right: 3px;
  bottom: 2px;
  background: var(--text-muted);
  transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
  background: rgba(99,102,241,0.3);
  border-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(-22px);
  background: var(--primary-light);
}

/* ===== Progress Bar ===== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-glass);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  transition: width 1s ease;
}

/* ===== Avatar ===== */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }
.avatar-xl { width: 80px; height: 80px; font-size: 32px; }

/* ===== Dropdown ===== */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition);
  z-index: 1000;
}

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

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

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

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