:root { --font-arabic: 'Cairo', sans-serif; --font-latin: 'Inter', 'Segoe UI', sans-serif; }
[dir="rtl"] body { font-family: var(--font-arabic); }
[dir="ltr"] body { font-family: var(--font-latin); }

/* ═══════════════════════════════════════════
   PROBLEM 1 — ACTIVE ITEM (icon + text visibility)
═══════════════════════════════════════════ */
.sidebar-link.active,
.sidebar-link.active i,
.sidebar-link.active .hide-menu {
  color: #ffffff !important;
}
.sidebar-link.active {
  background: linear-gradient(90deg, #1565C0, #0d47a1);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(13, 71, 161, 0.35);
}

/* ═══════════════════════════════════════════
   PROBLEM 2 — SPACING, TYPOGRAPHY & HOVER
═══════════════════════════════════════════ */
.sidebar-link {
  padding: 8px 15px;
  border-radius: 8px;
  margin: 1px 8px;
  font-size: 0.875rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-link:hover:not(.active) {
  background: rgba(21, 101, 192, 0.08);
  color: #1565C0;
}
.nav-small-cap {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #94a3b8;
  padding: 10px 15px 4px;
}

/* ═══════════════════════════════════════════
   PROBLEM 3 — USER PROFILE STRIP (flex push to bottom)
═══════════════════════════════════════════ */
.left-sidebar > div {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.sidebar-nav:hover { scrollbar-color: rgba(148, 163, 184, 0.6) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 9999px;
}
.sidebar-nav:hover::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.6); }
.sidebar-user-profile {
  padding: 1rem;
  padding-inline-end: 0.5rem;
  background: #fff;
  overflow: hidden;
}
.user-profile {
  padding: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.5rem;
  background: rgba(0,0,0,.025);
  transition: background .15s;
}
a.user-profile:hover { background: rgba(21,101,192,.08); }
.sidebar-avatar {
  width: 36px; 
  aspect-ratio: 1/1;
  border-radius: 100%;
  background: #1565C0; 
  color: #fff;
  font-size: 1rem; 
  font-weight: 700;
  display: flex; 
  align-items: center; 
  justify-content: center;
  flex-shrink: 0; 
  text-transform: uppercase;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-user-name {
  font-size: 0.82rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 160px; color: #2c3e50;
}
.sidebar-user-email {
  font-size: 0.72rem; color: #888;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 160px;
}
.sidebar-user-role {
  display: inline-block; font-size: 0.62rem;
  padding: 1px 6px; border-radius: 8px;
  background: #e3f2fd; color: #1565c0;
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; margin-top: 2px;
}

/* ═══════════════════════════════════════════
   PROBLEM 4 — RESPONSIVE SIDEBAR WIDTH
═══════════════════════════════════════════ */
@media (max-width: 1199px) {
  .left-sidebar { width: 260px; }
}

/* ═══════════════════════════════════════════
   PROBLEM 5 — RTL/LTR ACTIVE BORDER ACCENT
═══════════════════════════════════════════ */
.sidebar-link.active {
  border-inline-start: 3px solid #0d47a1;
  padding-inline-start: 12px;
}

/* ═══════════════════════════════════════════
   RTL — SIDEBAR LAYOUT
═══════════════════════════════════════════ */
[dir="rtl"] .left-sidebar { right: 0 !important; left: auto !important; transition: right 0.3s ease; }
[dir="rtl"] .body-wrapper { margin-right: 270px !important; margin-left: 0 !important; }
@media (max-width: 1199px) {
  [dir="rtl"] .left-sidebar { right: -260px !important; left: auto !important; }
  [dir="rtl"] .body-wrapper { margin-right: 0 !important; margin-left: 0 !important; }
  [dir="rtl"] #main-wrapper.show-sidebar .left-sidebar { right: 0 !important; }
}
[dir="rtl"] #sidebarCollapse { order: -1; }
[dir="rtl"] .brand-logo { flex-direction: row-reverse; }

.sidebar-nav ul .sidebar-item .sidebar-link { white-space: normal; display: flex; align-items: center }
.sidebar-nav ul .sidebar-item .sidebar-link i { flex-shrink: 0; display: flex; align-items: center; justify-items: center; width: 20px; aspect-ratio: 1/1; }
.sidebar-nav ul .sidebar-item .sidebar-link .hide-menu {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

/* ═══════════════════════════════════════════
   RTL — COMMON UTILITIES
═══════════════════════════════════════════ */
[dir="rtl"] .me-2 { margin-left: 0.5rem !important; margin-right: 0 !important; }
[dir="rtl"] .me-4 { margin-left: 1.5rem !important; margin-right: 0 !important; }
[dir="rtl"] .ms-auto { margin-right: auto !important; margin-left: 0 !important; }
[dir="rtl"] .form-select {
  background-position: left 0.75rem center;
  padding-left: 2rem; padding-right: 0.75rem;
}
[dir="rtl"] .start-50 { right: 50% !important; left: auto !important; }
[dir="rtl"] .translate-middle { transform: translate(50%, -50%) !important; }

/* ═══════════════════════════════════════════
   RTL — NAVBAR
═══════════════════════════════════════════ */
[dir="rtl"] .app-header .navbar-nav .nav-link { text-align: right; }
[dir="rtl"] .app-header .navbar-collapse .navbar-nav { flex-direction: row-reverse; }

/* ═══════════════════════════════════════════
   RTL — TABLES
═══════════════════════════════════════════ */
[dir="rtl"] .table th,
[dir="rtl"] .table td { text-align: right; }
[dir="rtl"] .table .text-end { text-align: left !important; }

/* ═══════════════════════════════════════════
   RTL — MISC TEXT/FLOAT
═══════════════════════════════════════════ */
[dir="rtl"] .text-start { text-align: right !important; }
[dir="rtl"] .text-end { text-align: left !important; }
[dir="rtl"] .float-end { float: left !important; }
[dir="rtl"] .float-start { float: right !important; }

#main-wrapper[data-layout="vertical"][data-header-position="fixed"] .app-header {
  z-index: 20;
}

/* ═══════════════════════════════════════════
   MOBILE SIDEBAR BACKDROP
═══════════════════════════════════════════ */
@media (max-width: 1199px) {
  #sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 998;
  }
  #main-wrapper.show-sidebar #sidebar-backdrop { display: block; }
  #main-wrapper.show-sidebar .left-sidebar { z-index: 999; }
  [dir="rtl"] #main-wrapper.show-sidebar .left-sidebar { right: 0 !important; left: auto !important; }
  .body-wrapper { margin-left: 0 !important; margin-right: 0 !important; }
}

/* ── Message alerts ── */
.alert-success-custom {
  background: #f0fdf4;
  border-inline-start: 4px solid #16a34a !important;
  color: #15803d;
}
.alert-success-custom .message-icon { color: #16a34a; }

.alert-error-custom {
  background: #fef2f2;
  border-inline-start: 4px solid #dc2626 !important;
  color: #b91c1c;
}
.alert-error-custom .message-icon { color: #dc2626; }

.alert-warning-custom {
  background: #fffbeb;
  border-inline-start: 4px solid #d97706 !important;
  color: #92400e;
}
.alert-warning-custom .message-icon { color: #d97706; }

.alert-info-custom {
  background: #eff6ff;
  border-inline-start: 4px solid #1565C0 !important;
  color: #0d47a1;
}
.alert-info-custom .message-icon { color: #1565C0; }

.icon-flex-class {
    width: fit-content;
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 0.25rem;
}

/* ═══════════════════════════════════════════
   Notifications styles
═══════════════════════════════════════════ */
.notify-badge {
  min-width: 24px !important;
  width: fit-content;
  aspect-ratio: 1/1;
  position: absolute;
  top: 0;
  right: 4px !important;
  left: auto !important;
  font-size: 0.65rem;
  padding: 0.35rem;
  border-radius: 100%;
  color: #fff;
}

[dir="rtl"] .notify-badge {
  right: auto !important;
  left: 4px !important;
}

.dropdown-menu{
  min-width: 320px !important;
  max-width: 380px !important;
}

@media (max-width: 567px) {
  .dropdown-menu{
    width: 320px !important;
    position: fixed !important;
    top: 60px !important;
    right: 16px !important;
  }
}

#float-dock {
position: fixed;
inset-block-end: 22px;
inset-inline-end: 22px;
z-index: 1048;
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 12px;
max-width: calc(100vw - 32px);
max-height: calc(100vh - 44px);
pointer-events: none;
}

#float-dock:empty { display: none; }

#float-dock > * {
position: static !important;
inset: auto !important;
margin: 0 !important;
pointer-events: auto;
flex-shrink: 0;
}

@media (max-width: 575.98px) {
#float-dock {
  inset-block-end: 16px;
  inset-inline-end: 16px;
  inset-inline-start: 16px;
  align-items: stretch;
  gap: 10px;
}
}
