/* ═══════════════════════════════════════════════════════════════════════════
   DAWAMAK — Enterprise HR & Biometrics Platform
   Dual-Theme System (Light Mode Primary Default + Dark Mode Switchable)
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* ── LIGHT MODE (Default Primary Theme) ─────────────────────────────────── */
:root, [data-theme="light"] {
  /* Brand Spectrum */
  --brand:         #6366F1;
  --brand-light:   #818CF8;
  --brand-lighter: #A5B4FC;
  --brand-dark:    #4F46E5;
  --brand-darker:  #3730A3;
  --brand-glow:    rgba(99, 102, 241, 0.2);
  --brand-gradient: linear-gradient(135deg, #6366F1 0%, #8B5CF6 50%, #EC4899 100%);
  --brand-gradient-subtle: linear-gradient(135deg, rgba(99,102,241,0.1) 0%, rgba(139,92,246,0.06) 100%);

  /* Light Surfaces (Clean, Crisp, Luxury) */
  --bg:            #F8FAFC;
  --bg-pattern:    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.08), transparent);
  --surface:       #FFFFFF;
  --surface-2:     #F1F5F9;
  --surface-3:     #E2E8F0;
  --surface-hover: #F8FAFC;
  --surface-glass: rgba(255, 255, 255, 0.85);

  /* Light Borders */
  --border:        rgba(15, 23, 42, 0.08);
  --border-subtle: rgba(15, 23, 42, 0.04);
  --border-bright: rgba(15, 23, 42, 0.14);
  --border-brand:  rgba(99, 102, 241, 0.3);

  /* Typography Colors (High Contrast) */
  --text-1:        #0F172A;
  --text-2:        #475569;
  --text-3:        #64748B;
  --text-muted:    #94A3B8;
  --text-inv:      #FFFFFF;

  /* Semantic Accents (Refined Light Mode Contrast) */
  --emerald:       #059669;
  --emerald-bg:    #ECFDF5;
  --emerald-border:#A7F3D0;
  --amber:         #D97706;
  --amber-bg:      #FFFBEB;
  --amber-border:  #FDE68A;
  --rose:          #E11D48;
  --rose-bg:       #FFF1F2;
  --rose-border:   #FECDD3;
  --sky:           #0284C7;
  --sky-bg:        #F0F9FF;
  --sky-border:    #BAE6FD;
  --violet:        #7C3AED;
  --violet-bg:     #F5F3FF;
  --violet-border: #DDD6FE;

  /* Soft Light Shadows */
  --shadow-sm:     0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md:     0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg:     0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-glow:   0 0 25px -5px rgba(99, 102, 241, 0.25);

  /* Radii */
  --r-xs:          6px;
  --r-sm:          10px;
  --r-md:          14px;
  --r-lg:          20px;
  --r-full:        9999px;

  /* Layout Constants */
  --sidebar-w:     260px;
  --header-h:      68px;
  --ease:          cubic-bezier(0.16, 1, 0.3, 1);
  --trans:         background-color 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

/* ── DARK MODE (Switchable) ─────────────────────────────────────────────── */
[data-theme="dark"] {
  --brand:         #6366F1;
  --brand-light:   #818CF8;
  --brand-lighter: #A5B4FC;
  --brand-dark:    #4F46E5;
  --brand-darker:  #3730A3;
  --brand-glow:    rgba(99, 102, 241, 0.3);
  --brand-gradient: linear-gradient(135deg, #6366F1 0%, #8B5CF6 50%, #EC4899 100%);
  --brand-gradient-subtle: linear-gradient(135deg, rgba(99,102,241,0.15) 0%, rgba(139,92,246,0.1) 100%);

  /* High-End Dark Surfaces */
  --bg:            #090A10;
  --bg-pattern:    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.15), transparent);
  --surface:       #11131F;
  --surface-2:     #17192A;
  --surface-3:     #1E2138;
  --surface-hover: #232742;
  --surface-glass: rgba(17, 19, 31, 0.85);

  /* Dark Borders */
  --border:        rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-bright: rgba(255, 255, 255, 0.16);
  --border-brand:  rgba(99, 102, 241, 0.4);

  /* Typography Colors */
  --text-1:        #F8FAFC;
  --text-2:        #94A3B8;
  --text-3:        #64748B;
  --text-muted:    #475569;
  --text-inv:      #0F172A;

  /* Semantic Accents */
  --emerald:       #10B981;
  --emerald-bg:    rgba(16, 185, 129, 0.12);
  --emerald-border:rgba(16, 185, 129, 0.25);
  --amber:         #F59E0B;
  --amber-bg:      rgba(245, 158, 11, 0.12);
  --amber-border:  rgba(245, 158, 11, 0.25);
  --rose:          #F43F5E;
  --rose-bg:       rgba(244, 63, 94, 0.12);
  --rose-border:   rgba(244, 63, 94, 0.25);
  --sky:           #0EA5E9;
  --sky-bg:        rgba(14, 165, 233, 0.12);
  --sky-border:    rgba(14, 165, 233, 0.25);
  --violet:        #8B5CF6;
  --violet-bg:     rgba(139, 92, 246, 0.12);
  --violet-border: rgba(139, 92, 246, 0.25);

  /* Dark Shadows */
  --shadow-sm:     0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md:     0 4px 16px -2px rgba(0, 0, 0, 0.4), 0 2px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg:     0 12px 32px -4px rgba(0, 0, 0, 0.5), 0 4px 12px -2px rgba(0, 0, 0, 0.3);
  --shadow-glow:   0 0 30px -5px rgba(99, 102, 241, 0.3);
}

/* ── Base Reset & Typography ────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Plus Jakarta Sans', 'Cairo', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  background-image: var(--bg-pattern);
  background-attachment: fixed;
  color: var(--text-1);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: none; outline: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ── Custom Scrollbar ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--brand); }

/* ── App Layout ─────────────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: var(--bg);
}

/* ── Modern Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.3s var(--ease), transform 0.3s var(--ease);
  z-index: 100;
  position: relative;
}

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

.brand-logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title span {
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  background: var(--brand-gradient-subtle);
  border: 1px solid var(--border-brand);
  color: var(--brand-dark);
}

[data-theme="dark"] .brand-badge {
  color: var(--brand-light);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--trans);
  position: relative;
  user-select: none;
}

.nav-item svg {
  flex-shrink: 0;
  color: var(--text-3);
  transition: var(--trans);
}

.nav-item:hover {
  color: var(--text-1);
  background: var(--surface-2);
}

.nav-item:hover svg {
  color: var(--brand);
}

.nav-item.active {
  color: var(--brand-dark);
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  font-weight: 600;
}

[data-theme="dark"] .nav-item.active {
  color: #FFFFFF;
  background: linear-gradient(90deg, rgba(99,102,241,0.18) 0%, rgba(99,102,241,0.06) 100%);
  border: 1px solid rgba(99,102,241,0.25);
}

.nav-item.active svg {
  color: var(--brand);
}

.nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--r-full);
  background: var(--rose-bg);
  color: var(--rose);
  border: 1px solid var(--rose-border);
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: var(--trans);
}

.user-card:hover {
  background: var(--surface-3);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.72rem;
  color: var(--text-3);
  text-transform: capitalize;
}

/* ── Main Content Area ──────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--header-h);
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-shrink: 0;
  z-index: 50;
}

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

.topbar-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--trans);
}

.topbar-toggle:hover {
  color: var(--text-1);
  border-color: var(--border-bright);
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
}

.breadcrumb-root { color: var(--text-3); font-weight: 500; }
.breadcrumb-sep { color: var(--text-muted); font-size: 0.75rem; }
.breadcrumb-current { color: var(--text-1); font-weight: 600; }

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

.topbar-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--trans);
  position: relative;
}

.topbar-btn:hover {
  color: var(--text-1);
  background: var(--surface-3);
  border-color: var(--border-bright);
}

.topbar-btn .btn-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: var(--r-full);
  background: var(--rose);
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

/* ── Page Content Container ─────────────────────────────────────────────── */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Page Header ────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.page-header-left h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-1);
  margin-bottom: 4px;
}

.page-header-left p {
  color: var(--text-2);
  font-size: 0.875rem;
}

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

/* ── Modern Cards & Containers ──────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--trans);
}

.card:hover {
  border-color: var(--border-bright);
  box-shadow: var(--shadow-md);
}

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

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-top: 2px;
}

.card-body {
  padding: 22px;
}

/* ── KPI Widgets Grid ───────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--trans);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient, var(--brand));
}

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

.kpi-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--brand);
  flex-shrink: 0;
}

.kpi-info {
  flex: 1;
  min-width: 0;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-1);
  line-height: 1.2;
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Modern Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--trans);
  white-space: nowrap;
  user-select: none;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--brand);
  background-image: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
  color: #FFFFFF;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background-image: linear-gradient(135deg, #7174F3 0%, #5B52EE 100%);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.45);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border-bright);
  color: var(--text-1);
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--text-muted);
}

.btn-danger {
  background: var(--rose-bg);
  border: 1px solid var(--rose-border);
  color: var(--rose);
}

.btn-danger:hover {
  background: var(--rose);
  color: #FFFFFF;
}

.btn-success {
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  color: var(--emerald);
}

.btn-success:hover {
  background: var(--emerald);
  color: #FFFFFF;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--r-xs);
}

.btn-sm svg { width: 14px; height: 14px; }

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--r-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Form Inputs ────────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-2);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-3);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-control {
  width: 100%;
  height: 42px;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--r-sm);
  padding: 0 14px;
  color: var(--text-1);
  font-size: 0.875rem;
  transition: var(--trans);
}

.input-wrap .form-control {
  padding-left: 42px;
}

.form-control:focus {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

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

.form-row {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Tables & Data Grids ────────────────────────────────────────────────── */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.table th {
  padding: 12px 16px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 14px 16px;
  color: var(--text-2);
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

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

.table tbody tr:hover {
  background: var(--surface-2);
}

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

/* ── Status Badges & Pills ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  line-height: 1.4;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-present, .badge-approved, .badge-active, .badge-online {
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  color: var(--emerald);
}

.badge-late, .badge-warning, .badge-pending {
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  color: var(--amber);
}

.badge-absent, .badge-rejected, .badge-terminated, .badge-offline {
  background: var(--rose-bg);
  border: 1px solid var(--rose-border);
  color: var(--rose);
}

.badge-leave, .badge-remote {
  background: var(--sky-bg);
  border: 1px solid var(--sky-border);
  color: var(--sky);
}

.badge-holiday {
  background: var(--violet-bg);
  border: 1px solid var(--violet-border);
  color: var(--violet);
}

.badge-neutral, .badge-offday {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-3);
}

/* ── Avatar Component ───────────────────────────────────────────────────── */
.emp-avatar {
  border-radius: var(--r-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  background: var(--brand-gradient);
  color: #FFFFFF;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.emp-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.emp-name {
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.2;
}

.emp-dept {
  font-size: 0.75rem;
  color: var(--text-3);
}

/* ── Modals & Overlays ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
  padding: 20px;
}

[data-theme="dark"] .modal-overlay {
  background: rgba(5, 6, 10, 0.75);
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.2s var(--ease);
}

.modal-overlay.show .modal-dialog {
  transform: scale(1) translateY(0);
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-1);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--r-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  cursor: pointer;
  transition: var(--trans);
}

.modal-close:hover {
  background: var(--surface-2);
  color: var(--text-1);
}

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

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: var(--surface-2);
}

/* ── Toast System ───────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--r-sm);
  padding: 12px 18px;
  color: var(--text-1);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.3s var(--ease);
  min-width: 280px;
}

.toast.success { border-left: 4px solid var(--emerald); }
.toast.error   { border-left: 4px solid var(--rose); }
.toast.warning { border-left: 4px solid var(--amber); }
.toast.info    { border-left: 4px solid var(--brand); }

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

/* ── Login Page ─────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  background: var(--bg);
}

.login-bg-glow {
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: blur(40px);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-bright);
  border-radius: var(--r-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
  z-index: 10;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header .logo-container {
  display: inline-flex;
  margin-bottom: 16px;
}

.login-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.03em;
}

.login-header p {
  color: var(--text-2);
  font-size: 0.875rem;
  margin-top: 4px;
}

.login-badges-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.feature-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}

.feature-tag svg { width: 12px; height: 12px; color: var(--brand); }

/* ── Utilities ──────────────────────────────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid var(--border-bright);
  border-top-color: var(--brand);
  animation: spin 0.7s linear infinite;
}

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

/* ── Empty State ────────────────────────────────────────────────────────── */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  margin-bottom: 16px;
}

.empty-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 0.85rem;
  color: var(--text-3);
  max-width: 320px;
}

/* ── Skeleton Loading ───────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: skeletonLoad 1.5s infinite;
  border-radius: var(--r-xs);
}

/* ── RTL (Arabic Primary Default) Styles ────────────────────────────────── */
[dir="rtl"] body {
  font-family: 'Cairo', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

[dir="rtl"] .sidebar {
  border-right: none;
  border-left: 1px solid var(--border);
}

[dir="rtl"] .sidebar::after {
  right: auto;
  left: 0;
}

[dir="rtl"] .nav-badge {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .topbar-btn .btn-badge {
  right: auto;
  left: -4px;
}

[dir="rtl"] .input-icon {
  left: auto;
  right: 14px;
}

[dir="rtl"] .input-wrap .form-control {
  padding-left: 14px;
  padding-right: 42px;
}

[dir="rtl"] .table th,
[dir="rtl"] .table td {
  text-align: right;
}

[dir="rtl"] .toast-container {
  right: auto;
  left: 24px;
}

[dir="rtl"] .toast.success { border-left: none; border-right: 4px solid var(--emerald); }
[dir="rtl"] .toast.error   { border-left: none; border-right: 4px solid var(--rose); }
[dir="rtl"] .toast.warning { border-left: none; border-right: 4px solid var(--amber); }
[dir="rtl"] .toast.info    { border-left: none; border-right: 4px solid var(--brand); }

