/* SweetAlert2 larger modal tweaks */
.swal2-title-lg {
  font-size: 1.35rem !important;
}
.swal2-confirm-lg, .swal2-cancel-lg {
  font-size: 0.95rem !important;
  padding: 0.55rem 1.2rem !important;
}

/* Header theme toggle button size */
.theme-toggle-btn {
  padding: 6px 10px !important;
  border-radius: 6px !important;
}
.theme-toggle-btn #themeToggleIcon {
  font-size: 18px !important;
}

@media (min-width: 992px) {
  .theme-toggle-btn #themeToggleIcon {
    font-size: 20px !important;
  }
  .theme-toggle-btn {
    padding: 8px 12px !important;
  }
}

/* Language switcher capsule */
.lang-switch {
  position: relative;
  display: inline-block;
  width: 64px;
  height: 28px;
}
.lang-switch input { display: none; }
.lang-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ff7f50; /* coral fits theme */
  border-radius: 999px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.15);
}
.lang-label { position: absolute; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.2); }
.lang-ar { left: 10px; }
.lang-en { right: 10px; }
.lang-switch .lang-slider:before {
  content: '';
  position: absolute;
  height: 22px; width: 22px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  transition: transform .25s ease;
}
.lang-switch input:checked + .lang-slider {
  background: #007bff; /* blue when EN active */
}
.lang-switch input:checked + .lang-slider:before {
  transform: translateX(36px);
}
/* Dark theme overrides (true dark) */
body.theme-dark {
  background: #0e0e0f !important; /* near-black */
  color: #e6e6e6 !important;
}

body.theme-dark .card-box,
body.theme-dark .page-header,
body.theme-dark .box,
body.theme-dark .box .box-body,
body.theme-dark .box .box-header,
body.theme-dark .dataTables_wrapper .dataTables_paginate .paginate_button,
body.theme-dark .table,
body.theme-dark .table thead th,
body.theme-dark .table td,
body.theme-dark .table th {
  background-color: #151515 !important; /* cards and panels */
  color: #e6e6e6 !important;
  border-color: #2a2a2a !important;
}

body.theme-dark .btn-primary {
  background-color: #1f6feb !important; /* accessible blue */
  border-color: #1f6feb !important;
}

body.theme-dark .breadcrumb-item a,
body.theme-dark .breadcrumb-item.active {
  color: #b8c7ff !important;
}

body.theme-dark .left-side-bar { background: #0f1115 !important; }
body.theme-dark .header { background: #0f1115 !important; }
/* ضمان أن الهيدر فوق السايدبار والقوائم تظهر فوق الكل */
.header { position: relative; z-index: 2001; }
body.theme-dark .sidebar-menu .dropdown-toggle,
body.theme-dark .sidebar-menu .submenu li a { color: #fff !important; }
body.theme-dark a { color: #8ab4f8; }

/* Improve button text contrast on dark theme */
body.theme-dark .btn,
body.theme-dark .btn:hover,
body.theme-dark .btn:focus {
  color: #f8f9fa !important;
  font-weight: 600;
  text-shadow: 0 1px 1px rgba(0,0,0,0.6);
}

/* Solid buttons */
body.theme-dark .btn-primary { background-color: #1f6feb !important; border-color: #1f6feb !important; }
body.theme-dark .btn-success { background-color: #2ba84a !important; border-color: #2ba84a !important; }
body.theme-dark .btn-info    { background-color: #0ea5e9 !important; border-color: #0ea5e9 !important; }
body.theme-dark .btn-warning { background-color: #f59e0b !important; border-color: #f59e0b !important; }
body.theme-dark .btn-danger  { background-color: #ef4444 !important; border-color: #ef4444 !important; }

/* Outline buttons: readable borders and text */
body.theme-dark .btn-outline-primary { color: #8ab4f8 !important; border-color: #3a74ff !important; }
body.theme-dark .btn-outline-success { color: #6ee7b7 !important; border-color: #22c55e !important; }
body.theme-dark .btn-outline-info    { color: #93c5fd !important; border-color: #3b82f6 !important; }
body.theme-dark .btn-outline-warning { color: #fde68a !important; border-color: #f59e0b !important; }
body.theme-dark .btn-outline-danger  { color: #fecaca !important; border-color: #ef4444 !important; }

/* Fill outline on hover for clarity */
body.theme-dark .btn-outline-primary:hover { background-color: #3a74ff !important; color: #fff !important; }
body.theme-dark .btn-outline-success:hover { background-color: #22c55e !important; color: #fff !important; }
body.theme-dark .btn-outline-info:hover    { background-color: #3b82f6 !important; color: #fff !important; }
body.theme-dark .btn-outline-warning:hover { background-color: #f59e0b !important; color: #1b1b1b !important; text-shadow: none; }
body.theme-dark .btn-outline-danger:hover  { background-color: #ef4444 !important; color: #fff !important; }

/* Small badges/pills that act like buttons */
body.theme-dark .badge, body.theme-dark .table .badge { color: #111 !important; font-weight: 700; }

/* Generic light backgrounds → dark */
body.theme-dark .bg-white,
body.theme-dark .bg-light,
body.theme-dark .card,
body.theme-dark .card-body,
body.theme-dark .panel,
body.theme-dark .panel-default,
body.theme-dark .well,
body.theme-dark .tab-content,
body.theme-dark .nav-tabs,
body.theme-dark .list-group-item,
body.theme-dark .dropdown-menu,
body.theme-dark .modal-content {
  background-color: #151515 !important;
  color: #e6e6e6 !important;
  border-color: #2a2a2a !important;
}

/* Tables striping in dark theme */
body.theme-dark .table-striped tbody tr:nth-of-type(odd) {
  background-color: #1a1a1a !important;
}

/* Light button variant in dark theme */
body.theme-dark .btn-light {
  background-color: #2a2a2a !important;
  border-color: #3a3a3a !important;
  color: #e6e6e6 !important;
}

/* Pagination and page links */
body.theme-dark .page-link {
  background-color: #1a1a1a !important;
  border-color: #2a2a2a !important;
  color: #d1d5db !important;
}
body.theme-dark .page-link:hover { background-color: #222 !important; }

/* Custom file input */
body.theme-dark .custom-file-label,
body.theme-dark .custom-file-input ~ .custom-file-label::after {
  background-color: #1a1a1a !important;
  color: #d1d5db !important;
  border-color: #2a2a2a !important;
}

/* Form controls in dark theme */
body.theme-dark .form-control,
body.theme-dark .custom-select,
body.theme-dark select,
body.theme-dark textarea,
body.theme-dark input[type="text"],
body.theme-dark input[type="email"],
body.theme-dark input[type="number"],
body.theme-dark input[type="password"],
body.theme-dark input[type="file"] {
  background-color: #0f1115 !important;
  color: #e6e6e6 !important;
  border-color: #2a2a2a !important;
}

body.theme-dark .form-control:focus,
body.theme-dark .custom-select:focus,
body.theme-dark select:focus,
body.theme-dark textarea:focus {
  background-color: #121417 !important;
  border-color: #3a74ff !important;
  box-shadow: 0 0 0 2px rgba(58, 116, 255, 0.25) !important;
}

body.theme-dark ::placeholder {
  color: #9aa0a6 !important;
  opacity: 1;
}

/* Tabs styling on dark */
body.theme-dark .nav-tabs .nav-link,
body.theme-dark .nav-tabs .nav-item.show .nav-link,
body.theme-dark .nav-tabs .nav-link.active {
  background-color: #151515 !important;
  color: #e6e6e6 !important;
  border-color: #2a2a2a #2a2a2a #151515 !important;
}

/* Small text blocks on profile sidebar */
body.theme-dark .profile-info ul li span,
body.theme-dark .profile-info ul li,
body.theme-dark .profile .text-muted {
  color: #c7c9cc !important;
}

/* Breadcrumb/header tweaks */
body.theme-dark .page-header { background-color: #151515 !important; }
body.theme-dark .breadcrumb { background: transparent !important; }
body.theme-dark .breadcrumb-item a { color: #9aa0a6 !important; }
body.theme-dark .breadcrumb-item.active { color: #d1d5db !important; }
body.theme-dark .breadcrumb-item + .breadcrumb-item::before { color: #6b7280 !important; }

/* Any search/input inside page header */
body.theme-dark .page-header input,
body.theme-dark .page-header .form-control,
body.theme-dark .search-icon-box input {
  background-color: #121417 !important;
  color: #e6e6e6 !important;
  border-color: #2a2a2a !important;
}
/* قواعد استجابة عامة للموقع */

/* وسائط وصور مرنة */
img, video, canvas, svg {
  max-width: 100%;
  height: auto;
}

/* جداول قابلة للتمرير على الشاشات الصغيرة */
@media (max-width: 767.98px) {
  .card-box table,
  .pd-20 table,
  table.dataTable {
    display: block;
    width: 100% !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* حقول النماذج بعرض كامل على الشاشات الصغيرة */
@media (max-width: 575.98px) {
  .form-control,
  .custom-select,
  select,
  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="password"],
  textarea {
    width: 100%;
  }

  .btn {
    width: 100%;
  }
}

/* هوامش ومسافات داخلية للمحتوى على الشاشات الصغيرة */
@media (max-width: 767.98px) {
  .pd-20 {
    padding: 12px !important;
  }
  .mb-30 {
    margin-bottom: 16px !important;
  }
}

/* ضبط ترويسة الموقع في الشاشات الصغيرة لمنع تراكب الأزرار */
@media (max-width: 991.98px) {
  .header-right {
    display: inline-flex !important;
    align-items: center;
    gap: 12px; /* مسافة مريحة بين الأزرار والبروفايل */
    flex-wrap: nowrap;
  }
  .header-right .mr-2,
  .header-right .language-dropdown {
    display: inline-flex !important;
    align-items: center;
  }
  /* ضمان أن المجموعة بالكامل تبقى بمحاذاة زر البروفايل بدون تلاصق */
  .header-right .user-info-dropdown { margin-inline-start: 4px; }
  .header-right .theme-toggle-btn { margin: 0; }
  .header-right .lang-switch { margin: 0; }
}

/* تموضع صريح قرب صورة البروفايل على الموبايل (واجهة عربية RTL) */
@media (max-width: 991.98px) {
  body[dir="rtl"] .header { position: relative; }
  body[dir="rtl"] .header-right .mr-2,
  body[dir="rtl"] .header-right .language-dropdown {
    position: fixed;
    top: 12px;
    z-index: 4002;
  }
  /* زر المظهر أقرب للصورة */
  body[dir="rtl"] .header-right .mr-2 { right: 72px; }
  /* زر اللغة يسبق المظهر بمسافة */
  body[dir="rtl"] .header-right .language-dropdown { right: 120px; }

  /* تموضع مماثل للواجهة الإنجليزية LTR */
  body[dir="ltr"] .header { position: relative; }
  body[dir="ltr"] .header-right .mr-2,
  body[dir="ltr"] .header-right .language-dropdown {
    position: fixed;
    top: 12px;
    z-index: 4002;
  }
  body[dir="ltr"] .header-right .mr-2 { right: 72px; }
  body[dir="ltr"] .header-right .language-dropdown { right: 120px; }
}

/* إخفاء أزرار اللغة/المظهر عند فتح السايدبار في الواجهة الإنجليزية */
@media (max-width: 991.98px) {
  body[dir="ltr"].sidebar-open .header-right .mr-2,
  body[dir="ltr"].sidebar-open .header-right .language-dropdown {
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  body[dir="ltr"]:not(.sidebar-open) .header-right .mr-2,
  body[dir="ltr"]:not(.sidebar-open) .header-right .language-dropdown {
    opacity: 1;
    pointer-events: auto;
  }
}

/* زر القائمة للهاتف: تأكيد ظهوره وجعله واضحًا */
@media (max-width: 991.98px) {
  .header-left {
    padding: 6px 8px;
  }

  /* موضع زر القائمة الافتراضي (يسار) */
  .menu-icon {
    display: inline-flex !important;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    background: #111827; /* داكن ليوضح فوق الخلفية */
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    cursor: pointer;
    z-index: 1101;
    position: fixed;
    top: 12px;
    left: 12px;  /* يبدأ يسار */
    right: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  }

  /* سلوك الإنجليزي (LTR): عند فتح السايدبار يتحرك الزر لليمين */
  body[dir="ltr"].sidebar-open .menu-icon {
    left: auto;
    right: 12px;
  }

  /* تحريك أزرار الهيدر (تغيير المظهر واللغة) حسب اتجاه الصفحة */
  .header-action {
    position: fixed;
    top: 12px;
    z-index: 4001; /* فوق السايدبار والأوفرلاي */
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
  }

  /* LTR: الأزرار بجوار زر القائمة يميناً عندما تُفتح السايدبار */
  body[dir="ltr"] .header-action { right: 60px; left: auto; }
  body[dir="ltr"].sidebar-open .header-action { right: 12px; }

  /* RTL: الأزرار تبدأ يساراً، وعند فتح السايدبار تتحرك لليسار/اليمين بما يمنع التغطية */
  body[dir="rtl"] .header-action { left: 60px; right: auto; }
  body[dir="rtl"].sidebar-open .header-action { left: 12px; }

  /* نترك العربي (RTL) كما هو حالياً بدون تغيير */

  .menu-icon:hover {
    background: #0b1220;
  }

  /* أيقونة الهامبرجر (3 شرائط) */
  .menu-icon::before {
    content: "";
    display: block;
    width: 20px;
    height: 2px;
    background: #ffffff;
    box-shadow: 0 -6px 0 #ffffff, 0 6px 0 #ffffff; /* أعلى وأسفل */
    border-radius: 2px;
  }
}

/* زر إغلاق السايدبار على الشاشات الصغيرة */
@media (max-width: 991.98px) {
  .left-side-bar .close-sidebar {
    position: absolute;
    top: 10px;
    inset-inline-start: 10px; /* يدعم RTL/LTR */
    width: 36px;
    height: 36px;
    display: flex; /* إظهار الزر دائماً في الموبايل */
    align-items: center;
    justify-content: center;
    background: #111827; /* داكن واضح */
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 3000;
    cursor: pointer;
  }

  /* شكل علامة X داخل زر الإغلاق */
  .left-side-bar .close-sidebar::before,
  .left-side-bar .close-sidebar::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
  }

  .left-side-bar .close-sidebar::before { transform: rotate(45deg); }
  .left-side-bar .close-sidebar::after  { transform: rotate(-45deg); }
}


/* تصغير عناصر التحويل للموبايل ومنع التزاحم */
@media (max-width: 575.98px) {
  .theme-toggle-btn { padding: 4px 8px !important; }
  .lang-switch { width: 56px; height: 24px; }
  .lang-switch .lang-label { font-size: 10px; }
  .lang-switch .lang-slider:before { height: 20px; width: 20px; }
}

/* إخفاء أيقونات عناصر قائمة البروفايل */
.user-info-dropdown .dropdown-menu .dropdown-item i {
  display: none !important;
}

/* إخفاء سهم الكيرت بجوار زر الأدمن (دائمًا) */
.user-info-dropdown .dropdown-toggle::after {
  display: none !important;
}

/* تأكيد ظهور قائمة البروفايل فوق السايدبار والأوفرلاي */
.user-info-dropdown .dropdown-menu {
  position: absolute;
  z-index: 5001; /* أعلى من السايدبار 1000 والأوفرلاي */
}
