body {
  font-family: 'Tajawal', sans-serif;
  background: #f8f9fa;
  color: #262626;
}

[dir="rtl"] body {
  direction: rtl;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(1px);
  display: none;
  z-index: 1030;
}

.overlay.show {
  display: block;
}

.sidebar {
  width: 240px;
  background: #ffffff;
  transition: width 0.3s, left 0.3s, right 0.3s, transform 0.3s;
  border-right: 1px solid #f1f5f9;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  padding-top: 84px;
  z-index: 1030;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.04);
}

[dir="rtl"] .sidebar {
  left: auto !important;
  right: 0 !important;
  border-right: 0;
  border-left: 1px solid #f1f5f9;
}

.sidebar .logo-area {
  position: absolute;
  top: 0;
  left: 0;
  right: auto;
  height: 84px;
  width: 100%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 16px;
  color: #111827;
  border-bottom: 1px solid #f1f5f9;
}

.sidebar-brand {
  max-width: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #262626;
  padding: 8px 10px;
  border-radius: 16px;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.sidebar-brand:hover {
  background: rgba(230, 98, 57, 0.05);
  transform: translateY(-1px);
}

.sidebar-brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #f1f5f9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(226, 168, 63, 0.1);
  flex: 0 0 52px;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-brand-text strong {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-brand-text small {
  font-size: 0.74rem;
  color: #6b7280;
  margin-top: 2px;
}

.sidebar-brand-logo {
  max-width: 38px;
  max-height: 38px;
  width: 38px;
  height: 38px;
  object-fit: contain;
}

[dir="rtl"] .sidebar .logo-area {
  left: auto !important;
  right: 0 !important;
  padding-left: 16px;
  padding-right: 16px;
}

.sidebar .nav-link {
  color: #4b5563;
  padding: 10px 10px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 14.5px;
  font-weight: 500;
  gap: 12px;
  white-space: nowrap;
  margin: 4px 8px;
  border-radius: 10px;
  width: calc(100% - 16px);
  overflow: hidden;
  text-align: left;
  box-sizing: border-box;
  transition: all 0.25s ease;
}

.sidebar-nav-form {
  width: 100%;
}

.sidebar-nav-form .nav-link {
  cursor: pointer;
  background: transparent;
}

.sidebar .nav-link.logout-link:hover {
  background: #dc3545 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.25) !important;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  color: #ffffff;
  background: #111827;
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.15);
  transform: translateY(-1px);
}

.sidebar .nav-link .ti {
  font-size: 18px;
  flex: 0 0 18px;
}

.sidebar .nav-text,
.logo-text {
  transition: opacity 0.2s;
}

.sidebar .nav-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar.collapsed {
  width: 60px;
}

.sidebar.collapsed .logo-area {
  height: 72px;
  padding: 10px 6px;
}

.sidebar.collapsed {
  padding-top: 72px;
}

.sidebar.collapsed .nav-link {
  margin: 0;
  background-color: transparent;
  padding: 8px 0;
  width: 100%;
  justify-content: center;
  gap: 0;
}

.sidebar.collapsed .nav-text,
.sidebar.collapsed .logo-text,
.sidebar.collapsed .sidebar-brand-text {
  display: none;
}

.sidebar.collapsed .sidebar-brand {
  justify-content: center;
  padding: 0;
}

.sidebar.collapsed .sidebar-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.sidebar.collapsed .sidebar-brand-logo {
  max-width: 28px;
  max-height: 28px;
  width: 28px;
  height: 28px;
}

.topbar {
  height: 60px;
  margin-left: 240px;
}

[dir="rtl"] .topbar {
  margin-left: 0;
  margin-right: 240px;
  direction: rtl;
}

.topbar.full {
  margin-left: 60px;
}

[dir="rtl"] .topbar.full {
  margin-left: 0;
  margin-right: 60px;
}

.content {
  margin-left: 240px;
  padding-top: 84px !important;
  padding-bottom: 1.5rem !important;
}

[dir="rtl"] .content {
  margin-left: 0;
  margin-right: 240px;
  direction: rtl;
}

.content.full {
  margin-left: 60px;
}

[dir="rtl"] .content.full {
  margin-left: 0;
  margin-right: 60px;
}

.avatar {
  position: relative;
  display: inline-block;
  width: 3rem;
  height: 3rem;
}

.avatar-sm {
  width: 2rem;
  height: 2rem;
}

.avatar-md {
  width: 2.5rem;
  height: 2.5rem;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.btn-icon {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
  font-size: 0.92969rem;
  font-weight: 400;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
}

.btn-icon.btn-sm {
  font-size: 0.875rem;
  width: 2.1875rem;
  height: 2.1875rem;
}

.icon-md {
  width: 2.5rem;
  height: 2.5rem;
  line-height: 2.5rem;
}

.icon-shape {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  vertical-align: middle;
}

.branding-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e9ecef;
  border-radius: 18px;
  padding: 1.25rem;
}

.branding-preview {
  min-height: 180px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  background: radial-gradient(circle at top, rgba(13, 110, 253, 0.08), transparent 55%), #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.branding-preview img {
  max-width: 100%;
  max-height: 90px;
  object-fit: contain;
}

.branding-preview-favicon img {
  max-height: 64px;
}

.branding-preview-loader img {
  max-height: 72px;
}

.loader-brand-image {
  max-width: 120px;
  max-height: 56px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.mt-6 {
  margin-top: 4rem !important;
}

.ms-n2 {
  margin-left: -0.5rem !important;
}

[dir="rtl"] .ms-n2 {
  margin-left: 0 !important;
  margin-right: -0.5rem !important;
}

[dir="rtl"] .sidebar .nav-link,
[dir="rtl"] .sidebar .logo-area,
[dir="rtl"] .list-group-item,
[dir="rtl"] .dropdown-item,
[dir="rtl"] .table,
[dir="rtl"] .card-header,
[dir="rtl"] .card-body,
[dir="rtl"] .form-label,
[dir="rtl"] .form-control,
[dir="rtl"] .form-select,
[dir="rtl"] p,
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4,
[dir="rtl"] h5,
[dir="rtl"] h6,
[dir="rtl"] td,
[dir="rtl"] th,
[dir="rtl"] small,
[dir="rtl"] label {
  text-align: right;
}

[dir="rtl"] .sidebar .logo-area,
[dir="rtl"] .sidebar-brand,
[dir="rtl"] .list-group-item,
[dir="rtl"] .topbar .dropdown-item {
  flex-direction: row-reverse;
}

[dir="rtl"] .sidebar .nav-link {
  justify-content: flex-start;
  text-align: right;
}

[dir="rtl"] .topbar .list-unstyled {
  justify-content: flex-start;
}

[dir="rtl"] .sidebar .sidebar-nav-form .nav-link {
  direction: rtl;
}

[dir="rtl"] .sidebar.collapsed .nav-link {
  justify-content: center;
  flex-direction: row;
  direction: ltr;
}

[dir="rtl"] .topbar .dropdown-menu,
[dir="rtl"] .dropdown-menu-end {
  right: auto !important;
  left: 0 !important;
}

[dir="rtl"] .topbar .navbar,
[dir="rtl"] .card-header,
[dir="rtl"] .table,
[dir="rtl"] .list-group-item,
[dir="rtl"] .row,
[dir="rtl"] .col,
[dir="rtl"] main {
  direction: rtl;
}

@media (max-width: 992px) {
  .sidebar {
    left: -240px;
    right: auto;
  }

  [dir="rtl"] .sidebar {
    left: auto !important;
    right: -240px !important;
  }

  .sidebar.mobile-show {
    left: 0;
    right: auto;
  }

  [dir="rtl"] .sidebar.mobile-show {
    left: auto !important;
    right: 0 !important;
  }

  .topbar {
    margin-left: 0 !important;
    width: 100% !important;
  }

  [dir="rtl"] .topbar {
    margin-right: 0 !important;
  }

  .content {
    margin-left: 0 !important;
  }

  [dir="rtl"] .content {
    margin-right: 0 !important;
  }
}

/* ── DataTables Custom Styling ─────────────────────────────── */
.dt-toolbar {
  padding: 1rem 1.5rem;
  background: #ffffff;
}

[dir="rtl"] .dt-toolbar {
  flex-direction: row;
}

.dataTables_wrapper .dataTables_filter {
  text-align: right;
  margin: 0;
}

.dataTables_wrapper .dataTables_filter label {
  display: flex;
  align-items: center;
  font-size: 0; /* Hide the text "Search:" */
  margin: 0;
}

.dataTables_wrapper .dataTables_filter input {
  margin-right: 0 !important;
  margin-left: 0 !important;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-family: 'Tajawal', sans-serif;
  width: 250px;
  outline: none;
  box-shadow: none;
  background-color: #fff;
  color: #334155;
  transition: all 0.2s;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.dt-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dataTables_wrapper .dataTables_length {
  margin: 0;
}

.dataTables_wrapper .dataTables_length label {
  font-family: 'Tajawal', sans-serif;
  font-size: 0.875rem;
  color: #64748b;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dataTables_wrapper .dataTables_length select {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.375rem 2rem 0.375rem 1rem;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.875rem;
  outline: none;
  background-color: #fff;
  color: #334155;
}

.dt-buttons {
  display: flex;
  gap: 0.5rem;
}

.dt-buttons .btn {
  font-family: 'Tajawal', sans-serif !important;
  font-size: 0.875rem !important;
  border-radius: 8px !important;
  padding: 0.375rem 1rem !important;
  border: 1px solid #e2e8f0 !important;
  background: #fff !important;
  color: #64748b !important;
  box-shadow: none !important;
  transition: all 0.2s !important;
}

.dt-buttons .btn:hover {
  background: #f8fafc !important;
  color: #334155 !important;
}

.dt-buttons .btn-excel {
  background-color: #10b981 !important;
  border-color: #10b981 !important;
  color: #fff !important;
}

.dt-buttons .btn-excel:hover {
  background-color: #059669 !important;
  border-color: #059669 !important;
}

table.dataTable {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  border-collapse: collapse !important;
}

table.dataTable thead th {
  background-color: #f1f5f9 !important;
  color: #475569;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 1rem;
  border-bottom: 0 !important;
  white-space: nowrap;
  text-align: center;
}

table.dataTable tbody td {
  font-size: 0.875rem;
  color: #334155;
  padding: 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  text-align: center;
}

table.dataTable.no-footer {
  border-bottom: 1px solid #f1f5f9;
}

/* Action Buttons (Circular) */
.btn-action-circle {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid;
  background: #fff;
  transition: all 0.2s;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}
.btn-action-circle.text-danger {
  border-color: #fecdd3;
  color: #ef4444;
}
.btn-action-circle.text-danger:hover {
  background-color: #ef4444;
  color: #fff;
  border-color: #ef4444;
}
.btn-action-circle.text-success {
  border-color: #bbf7d0;
  color: #10b981;
}
.btn-action-circle.text-success:hover {
  background-color: #10b981;
  color: #fff;
  border-color: #10b981;
}
.btn-action-circle.text-primary {
  border-color: #bfdbfe;
  color: #3b82f6;
}
.btn-action-circle.text-primary:hover {
  background-color: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}

.dt-footer {
  padding: 1rem 1.5rem;
  background: #ffffff;
}

.dataTables_wrapper .dataTables_info {
  font-family: 'Tajawal', sans-serif;
  font-size: 0.875rem;
  color: #64748b;
  padding-top: 0 !important;
}

.dataTables_wrapper .dataTables_paginate {
  padding-top: 0 !important;
  margin: 0 !important;
}

.dataTables_paginate .paginate_button {
  border-radius: 8px !important;
  font-family: 'Tajawal', sans-serif !important;
  font-size: 0.875rem !important;
  color: #64748b !important;
  border: 1px solid transparent !important;
  padding: 0.375rem 0.75rem !important;
  margin: 0 2px !important;
}

.dataTables_paginate .paginate_button:hover {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border-color: transparent !important;
}

.dataTables_paginate .paginate_button.current,
.dataTables_paginate .paginate_button.current:hover {
  background: #10b981 !important;
  border-color: #10b981 !important;
  color: #fff !important;
}

.dataTables_paginate .paginate_button.previous,
.dataTables_paginate .paginate_button.next {
  color: #64748b !important;
  font-weight: 500;
}

/* Column Visibility Dropdown Styling */
div.dt-button-collection {
  width: 250px !important;
  padding: 0.5rem !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
  border: 1px solid #e2e8f0 !important;
  background-color: #fff !important;
  margin-top: 5px !important;
}

div.dt-button-collection .dt-button {
  border-radius: 8px !important;
  padding: 0.6rem 0.75rem !important;
  text-align: right !important;
  font-family: 'Tajawal', sans-serif !important;
  font-size: 0.9rem !important;
  color: #334155 !important;
  background: transparent !important;
  border: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  box-shadow: none !important;
  margin-bottom: 2px !important;
  width: 100% !important;
}

div.dt-button-collection .dt-button:hover {
  background-color: #f8fafc !important;
}

div.dt-button-collection .dt-button.active {
  background-color: transparent !important;
  color: #334155 !important;
  box-shadow: none !important;
}

div.dt-button-collection .dt-button span {
  flex-grow: 1;
}

/* Custom Checkbox for ColVis items */
div.dt-button-collection .dt-button::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid #cbd5e1;
  background-color: #fff;
  transition: all 0.2s;
  flex-shrink: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 14px 14px;
}

div.dt-button-collection .dt-button.active::before {
  background-color: #10b981;
  border-color: #10b981;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='white'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E");
}

/* RTL Specific Layout */
[dir="rtl"] div.dt-button-collection .dt-button {
  justify-content: space-between !important;
}

[dir="rtl"] div.dt-button-collection .dt-button span {
  order: 1;
  text-align: right;
}

[dir="rtl"] div.dt-button-collection .dt-button::before {
  order: 2;
}

