body.has-splash {
  overflow: hidden !important;
  height: 100vh !important;
}

/* Custom Searchable Dropdown Widget */
.custom-searchable-select {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  background: #f3f4f6;
  border: 1.5px solid transparent;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.custom-select-trigger:hover,
.custom-searchable-select.active .custom-select-trigger {
  border-color: var(--primary);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px rgba(21, 128, 103, 0.12);
}

.custom-select-trigger .trigger-arrow {
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.custom-searchable-select.active .trigger-arrow {
  transform: rotate(180deg);
  color: var(--primary);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  background: var(--card-bg);
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  z-index: 1050;
  display: none;
  overflow: hidden;
}

.custom-searchable-select.active .custom-select-menu {
  display: block;
  animation: fadeInDown 0.15s ease-out;
}

.custom-select-search-box {
  position: relative;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg);
}

.custom-select-search-box i {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
}

.custom-select-search-box input {
  width: 100%;
  height: 38px;
  padding-right: 36px;
  padding-left: 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 700;
  background: var(--card-bg);
  color: var(--text-main);
  outline: none;
}

.custom-select-search-box input:focus {
  border-color: var(--primary);
}

.custom-select-options {
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.custom-select-option {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.15s ease;
}

.custom-select-option:hover,
.custom-select-option.selected {
  background: var(--primary-light);
  color: var(--primary);
}

.custom-select-option .stock-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #158067;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 99999;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s ease;
  overflow: hidden;
}

.splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  animation: splashZoomIn 0.8s ease-out forwards;
}

@keyframes splashZoomIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.splash-logo-wrap {
  position: relative;
  width: 130px;
  height: 130px;
  margin-bottom: 24px;
}

.splash-logo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--accent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 2;
}

.splash-pulse {
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: splashPulse 2s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
  z-index: 1;
  opacity: 0.7;
}

@keyframes splashPulse {
  0% {
    transform: scale(0.9);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.3;
  }
  100% {
    transform: scale(0.9);
    opacity: 0.8;
  }
}

.splash-title {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.5;
  margin-bottom: 8px;
  text-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.splash-title span {
  color: #ffd700;
  font-size: 20px;
  font-weight: 700;
}

.splash-subtitle {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 28px;
  font-weight: 600;
}

@keyframes gentlePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }
  50% {
    transform: scale(1.04);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

.splash-enter-btn {
  background: #0d6c57;
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  padding: 16px 48px;
  font-size: 19px;
  font-weight: 800;
  border-radius: 40px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  margin-bottom: 34px;
  position: relative;
  z-index: 10;
  overflow: hidden;
  animation: gentlePulse 2.8s infinite ease-in-out;
}

/* حركة المرآة واللمعان الفاخر (Mirror Shine Sweep) */
.splash-enter-btn::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.35) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(25deg);
  transition: all 0.65s ease;
  pointer-events: none;
}

.splash-enter-btn:hover {
  animation-play-state: paused;
  background: #0b5a48;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.85);
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}

.splash-enter-btn:hover::after {
  left: 125%;
}

/* تنبيه حقوق الناشر في شاشة الترحيب بدون باج */
.splash-notice-wrap {
  max-width: 600px;
  width: 90%;
  margin-top: 36px;
  text-align: center;
  position: relative;
  z-index: 10;
}

.notice-prefix {
  color: #ffd700;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 4px;
}

.notice-prefix i {
  font-size: 17px;
  color: #ffd700;
}

.splash-notice-body {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.92);
  margin: 0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

html.cart-open,
body.cart-open {
  overflow: hidden !important;
  height: 100vh !important;
}

/* ==========================================================================
   تبويب إدارة الأعضاء والمشرفين (Members Management)
   ========================================================================== */
.member-role-badge {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.role-admin {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.role-editor {
  background: #e6f7f2;
  color: #0f766e;
  border: 1px solid #99f6e4;
}

.role-supervisor {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.action-btn-circle {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: #f1f5f9;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn-circle:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.action-btn-circle.edit:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.action-btn-circle.delete:hover {
  background: #fee2e2;
  color: #dc2626;
}

.action-btn-circle.hidden-btn {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.action-btn-circle.hidden-btn:hover {
  background: #fca5a5;
  color: #991b1b;
}

/* ==========================================================================
   تطبيقات متجر المؤلّفات - العرض والتصميم العام (Design System & Tokens)
   ========================================================================== */

:root {
  /* الألوان الرئيسية - أخضر زمردي فاخر وفاتح قليلاً + ذهبي إسلامي */
  --primary: #158067;
  --primary-hover: #116854;
  --primary-light: #e6f4f0;
  --primary-dark: #0d5645;

  --accent: #c49b3b;
  --accent-light: #fefce8;
  --accent-dark: #8c6d1f;

  --secondary: #0b355d;
  --secondary-light: #e0f2fe;

  --bg: #f6f8f7;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #475569;
  --border-color: #e5e7eb;

  --danger: #dc2626;
  --danger-light: #fef2f2;
  --success: #16a34a;
  --warning: #d97706;

  /* النوافذ والظلال */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  /* زخرفة إسلامية مضمّنة */
  --ornament-svg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 200 200'><defs><pattern id='p' width='40' height='40' patternUnits='userSpaceOnUse'><path d='M0 20 H40 M20 0 V40 M0 0 L40 40 M40 0 L0 40' stroke='%23c49b3b' stroke-opacity='0.2' stroke-width='1'/><circle cx='20' cy='20' r='6' fill='none' stroke='%23c49b3b' stroke-opacity='0.2' stroke-width='1'/></pattern></defs><rect width='100%25' height='100%25' fill='url(%23p)'/></svg>");
}

/* الوضع الداكن - Dark Theme Override */
body.dark-theme {
  --bg: #0b1329;
  --card-bg: #111c38;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: #1e2d54;
  --primary-light: rgba(21, 128, 103, 0.25);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.6);
}

/* إصلاح الجداول والـ Table Headers في الوضع الداكن */
body.dark-theme table thead tr,
body.dark-theme table thead th,
body.dark-theme .admin-table thead tr,
body.dark-theme .admin-table thead th {
  background-color: #162244 !important;
  color: #f1f5f9 !important;
  border-bottom-color: #1e2d54 !important;
}

body.dark-theme table tbody tr,
body.dark-theme .admin-table tbody tr {
  background-color: #111c38 !important;
  color: #f1f5f9 !important;
  border-bottom-color: #1e2d54 !important;
}

body.dark-theme table tbody tr:hover,
body.dark-theme .admin-table tbody tr:hover {
  background-color: #172447 !important;
}

/* إصلاح صفوف الكتب الحالية */
body.dark-theme .admin-book-row {
  background-color: #111c38 !important;
  border-color: #1e2d54 !important;
}

body.dark-theme .admin-book-row:hover {
  background-color: #172447 !important;
}

/* إصلاح الحقول والنوافذ والمدخلات في الوضع الداكن */
body.dark-theme .form-control,
body.dark-theme input[type="text"],
body.dark-theme input[type="number"],
body.dark-theme input[type="email"],
body.dark-theme input[type="password"],
body.dark-theme textarea,
body.dark-theme select,
body.dark-theme .custom-dropdown-btn {
  background-color: #172447 !important;
  color: #f1f5f9 !important;
  border-color: #24345d !important;
}

body.dark-theme .form-control::placeholder,
body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder {
  color: #64748b !important;
}

/* إصلاح الأزرار الدائرية (التعديل/الحذف) في الجدول */
body.dark-theme .action-btn-circle {
  background-color: #1a274a !important;
  color: #cbd5e1 !important;
  border-color: #283a66 !important;
}

body.dark-theme .action-btn-circle:hover {
  background-color: var(--primary) !important;
  color: #ffffff !important;
}

/* إصلاح القوائم المنسدلة والنوافذ المنبثقة والكروت ومربع رفع الصور */
body.dark-theme .custom-dropdown-menu,
body.dark-theme .modal-card,
body.dark-theme .custom-switch-card {
  background-color: #111c38 !important;
  border-color: #1e2d54 !important;
  color: #f1f5f9 !important;
}

body.dark-theme .image-dropzone-box {
  background-color: rgba(21, 128, 103, 0.15) !important;
  border-color: var(--primary) !important;
}

body.dark-theme .custom-dropdown-item {
  color: #cbd5e1 !important;
}

body.dark-theme .custom-dropdown-item:hover {
  background-color: #172447 !important;
  color: #ffffff !important;
}

/* ==========================================================================
   شريط التمرير الفاخر المخصص لجميع أجزاء الموقع (Global Emerald Scrollbar System)
   ========================================================================== */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: var(--primary-light);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-hover);
}

/* إخفاء شريط التمرير بالكامل عند فتح النوافذ المنبثقة لمنع التمرير الخلفي ومحو السكرول بار */
body.modal-open,
html.modal-open {
  overflow: hidden !important;
  scrollbar-width: none !important; /* Firefox */
  -ms-overflow-style: none !important; /* IE & Edge */
}

body.modal-open::-webkit-scrollbar,
html.modal-open::-webkit-scrollbar {
  display: none !important; /* Chrome / Safari / Edge */
  width: 0 !important;
  height: 0 !important;
}

/* للدعم القياسي في المتصفحات الحديثة (Firefox Scrollbar Styling) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--primary-light);
}

/* الأساسيات */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  direction: rtl;
  text-align: right;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* طبقة الزخرفة الإعلانية في الخلفية */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 260px;
  background-image: var(--ornament-svg);
  background-size: 130px 130px;
  background-repeat: repeat;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0.7) 60%, rgba(0,0,0,0) 100%);
          mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0.7) 60%, rgba(0,0,0,0) 100%);
}

.app-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 16px 40px;
}

/* الهيدر العلوي والشعار - ثابت أعلى الصفحة متجاوب 100% */
.top-nav {
  background: var(--primary);
  color: #ffffff;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 500;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.top-nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  height: 60px;
  width: 100%;
  box-sizing: border-box;
  gap: 8px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  flex: 1;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .top-nav-container {
    padding: 6px 10px;
    height: 52px;
    gap: 6px;
  }
  .brand-title {
    font-size: 13px;
  }
  .brand-logo {
    width: 32px;
    height: 32px;
  }
  .brand-section {
    gap: 8px;
  }
  .nav-actions {
    gap: 6px;
  }
  .icon-btn {
    width: 36px !important;
    height: 36px !important;
    font-size: 17px !important;
    border-radius: 10px !important;
  }
}

/* ==========================================================================
   سلة التسوق المنزلقة والمتجاوبة بالكامل على جميع الشاشات (Cart Drawer)
   ========================================================================== */
.cart-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  justify-content: flex-start;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overscroll-behavior: contain;
}

.cart-drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.cart-drawer {
  width: 100%;
  max-width: 440px;
  height: 100%;
  height: 100dvh;
  background: var(--card-bg);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  overscroll-behavior: contain;
}

.cart-drawer-overlay.active .cart-drawer {
  transform: translateX(0);
}

.cart-header {
  height: 56px;
  background: var(--primary);
  color: #ffffff;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

/* منطقة التمرير الموحدة الواحدة لجميع محتويات السلة */
.cart-content-scroll {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  display: block;
  overscroll-behavior: contain;
}

.cart-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
  overflow: visible !important;
  max-height: none !important;
}

.cart-footer {
  padding: 14px;
  border-top: 1.5px solid var(--border-color);
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: visible !important;
  max-height: none !important;
}

/* شريط تمرير موحد أنيق وأخضر للنافذة */
.cart-content-scroll::-webkit-scrollbar {
  width: 6px;
}

.cart-content-scroll::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 4px;
}

.cart-content-scroll::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

/* الشريط السفلي المباشر والمثبت دائماً لزر إتمام الطلب */
.cart-sticky-footer {
  flex-shrink: 0;
  padding: 12px 16px;
  background: var(--card-bg);
  border-top: 1.5px solid var(--border-color);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  z-index: 10;
}

@media (max-width: 480px) {
  .cart-drawer {
    max-width: 100%;
  }
  .cart-body {
    padding: 10px 12px;
  }
  .cart-footer {
    padding: 10px 12px;
    gap: 8px;
  }
  .cart-footer .form-group {
    margin-bottom: 0 !important;
  }
  .cart-footer .form-control {
    height: 40px !important;
    font-size: 13px !important;
    border-radius: 10px !important;
  }
  .cart-sticky-footer {
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  #cartCheckoutBtn {
    height: 46px !important;
    font-size: 15px !important;
  }
}

.icon-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: var(--accent);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cart-badge {
  position: absolute;
  top: -3px;
  left: -3px;
  background: var(--danger);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.6);
  border: 2px solid var(--primary);
  font-variant-numeric: tabular-nums;
}

/* قسم الهيرو Hero Banner */
.hero-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin: 20px 0 24px;
  padding: 32px 24px;
  text-align: center;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 4px;
  background: linear-gradient(to left, var(--primary), var(--accent));
}

.hero-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  object-fit: cover;
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
  margin-bottom: 16px;
}

.hero-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
}

body.dark-theme .hero-title {
  color: #38bdf8;
}

.hero-subtitle {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  display: inline-block;
  position: relative;
}

.hero-subtitle::after {
  content: "";
  display: block;
  width: 60%;
  height: 3px;
  background: var(--accent);
  margin: 6px auto 0;
  border-radius: 2px;
}

.sponsor-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 6px 16px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 700;
  margin-top: 10px;
  border: 1px solid rgba(15, 81, 50, 0.15);
}

.sponsor-badge img {
  height: 24px;
  width: auto;
}

body.dark-theme .sponsor-badge {
  color: #6ee7b7;
  border-color: rgba(110, 231, 183, 0.2);
}

/* شريط التحكم، البحث، والتصفية */
.controls-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 28px !important;
  margin-bottom: 24px;
}

.controls-container .form-group input,
.filter-card,
.delivery-card {
  height: 52px !important;
  border-radius: 12px !important;
  box-sizing: border-box !important;
}

.filter-card, .delivery-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 0 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-card {
  position: relative;
  cursor: pointer;
  user-select: none;
}

.filter-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

body.dark-theme .filter-badge {
  color: #38bdf8;
}

.filter-label {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
}

.dropdown-icon {
  font-size: 16px;
  transition: transform 0.2s ease;
}

.filter-card.open .dropdown-icon {
  transform: rotate(180deg);
}

.filter-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0; left: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: none;
  flex-direction: column;
  max-height: 280px;
  overflow-y: auto;
}

.filter-dropdown.show {
  display: flex;
}

.dropdown-option {
  padding: 12px 16px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dropdown-option:hover {
  background: var(--primary-light);
}

.dropdown-option.active {
  font-weight: 700;
  color: var(--primary);
}

/* بطاقة المحافظات والتوصيل */
.delivery-card {
  background: var(--primary-light);
  border-color: rgba(15, 81, 50, 0.2);
  color: var(--primary);
  font-weight: 700;
  justify-content: center;
  font-size: 15px;
}

body.dark-theme .delivery-card {
  color: #6ee7b7;
}

/* بطاقات التحميل الهيكلية - Skeleton Loaders */
.skeleton-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.skeleton {
  background: linear-gradient(90deg, rgba(200, 200, 200, 0.15) 25%, rgba(200, 200, 200, 0.3) 50%, rgba(200, 200, 200, 0.15) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s infinite ease-in-out;
  border-radius: 6px;
}

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

.skeleton-image {
  width: 130px;
  height: 180px;
  border-radius: var(--radius-sm);
}

.skeleton-title {
  width: 80%;
  height: 20px;
}

.skeleton-text {
  width: 60%;
  height: 14px;
}

.skeleton-btn {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

/* شبكة عرض الكتب (Book Grid) */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

@keyframes bookFadeInUp {
  0% {
    opacity: 0;
    transform: translateY(32px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.book-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease;
  overflow: hidden;
  opacity: 0;
  transform: translateY(32px) scale(0.96);
  will-change: opacity, transform;
}

.book-card.reveal-active {
  animation: bookFadeInUp 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.book-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(15, 81, 50, 0.3);
}

.book-cover-wrap {
  width: 100%;
  height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  position: relative;
  background: radial-gradient(circle, rgba(0,0,0,0.03) 0%, rgba(0,0,0,0.08) 100%);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.book-cover {
  max-height: 190px;
  max-width: 140px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.2);
  transition: transform 0.3s ease;
}

.book-card:hover .book-cover {
  transform: scale(1.05);
}

/* شارات الحالة (Stock & Visibility Badges) */
.badge-status {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.badge-in-stock {
  background: #dcfce7;
  color: var(--success);
}

/* بطاقات الإحصاء الصغيرة في لوحة التحكم */
.admin-count-badge {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  background: var(--primary) !important;
  color: #ffffff !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  padding: 10px 22px !important;
  border-radius: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  box-shadow: 0 4px 14px rgba(21, 128, 103, 0.25) !important;
  white-space: nowrap !important;
}

/* ==========================================================================
   قوائم الاختيار المخصصة الفاخرة (Ultra Custom Dropdown Component)
   ========================================================================== */
.custom-dropdown {
  position: relative;
  width: 100%;
}

.custom-dropdown-btn {
  width: 100%;
  height: 48px;
  background: var(--bg);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 800;
  color: var(--primary);
  font-size: 14px;
  transition: all 0.2s ease;
  user-select: none;
}

.custom-dropdown-btn:hover,
.custom-dropdown.open .custom-dropdown-btn {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 81, 50, 0.12);
}

.dropdown-selected-val {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-arrow {
  color: var(--primary);
  font-size: 16px;
  font-weight: 800;
  transition: transform 0.2s ease;
}

.custom-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  z-index: 1200;
  max-height: 200px;
  overflow-y: auto;
  padding: 6px;
  display: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.custom-dropdown.open .custom-dropdown-menu {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* التمرير الفخم للـ Scrollbar الخاص بالقائمة */
.custom-dropdown-menu::-webkit-scrollbar {
  width: 6px;
}

.custom-dropdown-menu::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

.custom-dropdown-menu::-webkit-scrollbar-track {
  background: var(--primary-light);
  border-radius: 10px;
}

/* مربع رفع ومعاينة صورة الغلاف النقطي الفاخر */
.image-dropzone-box {
  position: relative;
  width: 140px;
  height: 184px;
  border: 2px dashed var(--primary);
  border-radius: 14px;
  background: var(--primary-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.2s ease;
  padding: 8px;
  box-sizing: border-box;
}

.image-dropzone-box:hover {
  border-color: var(--primary-dark, #093c24);
  background: rgba(15, 81, 50, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 81, 50, 0.15);
}

.remove-image-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--danger);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 3px 8px rgba(220, 38, 38, 0.4);
  transition: transform 0.2s ease, background 0.2s ease;
}

.remove-image-badge:hover {
  transform: scale(1.15);
  background: #b91c1c;
}

.custom-dropdown-item {
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s ease, color 0.15s ease;
}

.custom-dropdown-item i {
  color: var(--primary);
  font-size: 16px;
  flex-shrink: 0;
}

.custom-dropdown-item:hover,
.custom-dropdown-item.selected {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-out-of-stock {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-hidden {
  background: #f1f5f9;
  color: var(--text-muted);
}

.book-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.book-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 48px;
}

body.dark-theme .book-title {
  color: #38bdf8;
}

.book-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.book-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  line-height: 1.4;
}

.book-meta-item i {
  font-size: 14px;
  flex-shrink: 0;
  color: #158067;
}

body.dark-theme .book-meta-item i {
  color: #34d399;
}

.book-meta-label {
  color: var(--text-muted);
  font-weight: 600;
}

.book-meta-val {
  color: var(--text-main);
  font-weight: 700;
}

.book-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
}

.book-price-row .btn-primary {
  height: 40px !important;
  padding: 0 16px !important;
  font-weight: 800 !important;
  font-size: 14px !important;
  border-radius: 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
}

.price-tag {
  font-size: 18px;
  font-weight: 800;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}

body.dark-theme .price-tag {
  color: #fdba74;
}

/* الأزرار العامة */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(21, 128, 103, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(21, 128, 103, 0.35);
}

.btn-secondary {
  background: var(--secondary);
  color: #ffffff;
}

.btn-secondary:hover {
  background: #092c4e;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.btn-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* النافذة المنبثقة (Modal) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  overflow: hidden !important; /* إلغاء ومنع أي سكرول بار خارجي على الشاشة المعتمة */
  opacity: 0;
  transition: background 0.35s ease, backdrop-filter 0.35s ease, -webkit-backdrop-filter 0.35s ease, opacity 0.35s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: modalOverlayFadeIn 0.35s ease forwards;
}

@keyframes modalOverlayFadeIn {
  from { opacity: 0; background: rgba(0,0,0,0); }
  to { opacity: 1; background: rgba(0,0,0,0.65); }
}

.modal-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto; /* التمرير يعمل بسلاسة دون الحاجة لرسم شريط سكرول بار */
  padding: 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  position: relative;
  margin: auto;
  opacity: 0;
  transform: translateY(40px) scale(0.95);
  scrollbar-width: none !important; /* Firefox */
  -ms-overflow-style: none !important; /* IE / Edge */
}

/* إخفاء شريط التمرير بالكامل لمتصفحات Chrome, Safari, Edge */
.modal-card::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.modal-overlay.active .modal-card {
  animation: modalCardSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.05s forwards;
}

@keyframes modalCardSlideIn {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  60% {
    opacity: 1;
    transform: translateY(-6px) scale(1.01);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--primary-light);
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-main);
  z-index: 100; /* يضمن رفع زر الإغلاق فوق جميع العناصر الداخلية للنافذة */
  transition: all 0.2s ease;
}

.modal-close i {
  pointer-events: none; /* ينقل أي ضغطة على الأيقونة إلى الزر نفسه مباشرة */
}

.modal-close:hover {
  background: #ef4444;
  color: #ffffff;
  transform: scale(1.1);
}

/* سلة التسوق المنزلقة (Cart Drawer) */
.cart-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1100;
  display: flex;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s ease;
}

.cart-drawer-overlay.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.cart-drawer {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  left: auto !important;
  background: var(--card-bg);
  width: min(440px, 100vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.35);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.cart-drawer-overlay.active .cart-drawer {
  transform: translateX(0) !important;
}

.cart-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary);
  color: #ffffff;
  flex-shrink: 0;
}

.cart-body {
  flex: 1 1 auto;
  min-height: 150px;
  max-height: 300px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg);
}

.cart-item {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--card-bg);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.cart-item-thumb {
  width: 52px;
  height: 68px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
  flex-shrink: 0;
  background: #f1f5f9;
}

.cart-item-details {
  flex: 1;
  min-width: 0;
}

.cart-item-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.cart-item-price {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.cart-item-ctrls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.cart-qty-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg);
  padding: 2px 4px;
}

.cart-qty-btn {
  background: none;
  border: none;
  width: 26px;
  height: 26px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  border-radius: 50%;
}

.cart-qty-btn:hover {
  background: rgba(15, 81, 50, 0.1);
}

.cart-qty-num {
  padding: 0 8px;
  font-weight: 800;
  font-size: 13px;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.cart-delete-btn {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.2s ease;
}

.cart-delete-btn:hover {
  background: var(--danger);
  color: #ffffff;
}

.cart-footer {
  flex: 0 1 auto;
  overflow-y: auto;
  padding: 16px 20px;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* تنسيق قائمة المحافظات المخصصة */
#custGov {
  height: 46px;
  border-radius: 12px;
  background-color: var(--bg);
  border: 1.5px solid var(--border-color);
  padding: 0 14px;
  font-weight: 700;
  color: var(--primary);
  font-size: 14px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23158067' class='bi bi-chevron-down' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  background-size: 16px 16px;
  padding-left: 38px;
}

#custGov:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 128, 103, 0.15);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 81, 50, 0.15);
}



/* زر الصعود للأعلى */
.back-to-top {
  position: fixed;
  bottom: 24px;
  left: 24px !important;
  right: auto !important;
  background: var(--primary);
  color: #ffffff;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(21, 128, 103, 0.35);
  z-index: 90;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.back-to-top:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 10px 24px rgba(21, 128, 103, 0.45);
}

/* زر إضافة كتاب جديد/تصنيف جديد العائم (Floating Action Button) */
.fab-btn {
  position: fixed;
  bottom: 28px;
  left: 28px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  width: 54px !important;
  height: 54px !important;
  min-width: 54px !important;
  min-height: 54px !important;
  border-radius: 14px !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 26px !important;
  box-shadow: 0 8px 24px rgba(21, 128, 103, 0.4) !important;
  cursor: pointer;
  z-index: 9999;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.fab-btn:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 30px rgba(21, 128, 103, 0.5) !important;
}

/* الفوتر الرئيسي */
.main-footer {
  text-align: center;
  padding: 18px 16px;
  color: var(--text-muted);
  font-size: 14px;
  border-top: 1px solid var(--border-color);
  margin-top: 12px;
}

/* ==========================================================================
   لوحة التحكم المتقدمة - شريط جانبي وتبويبات (Advanced Dashboard Sidebar System)
   ========================================================================== */
html.admin-body, body.admin-body {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  height: auto !important;
  min-height: 100vh !important;
}

.admin-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  transition: all 0.3s ease;
}

.admin-sidebar {
  width: 220px;
  height: 100vh;
  background: var(--card-bg);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  z-index: 1000;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 15px rgba(0,0,0,0.03);
  overflow: hidden;
}

.admin-sidebar.sidebar-collapsed {
  width: 78px;
}

.admin-sidebar-header {
  height: 70px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.admin-sidebar-header img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  flex-shrink: 0;
  object-fit: cover;
}

.admin-sidebar-header .title-text {
  font-weight: 800;
  font-size: 18px;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  line-height: 1;
  transition: opacity 0.2s ease;
}

.admin-sidebar.sidebar-collapsed .title-text,
.admin-sidebar.sidebar-collapsed .nav-text {
  display: none;
}

.admin-sidebar.sidebar-collapsed .admin-nav-item {
  position: relative;
  justify-content: center;
  padding: 12px 0;
}

.sidebar-unread-badge {
  background: var(--danger, #ef4444);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: auto;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
  line-height: 1;
}

.admin-sidebar.sidebar-collapsed .sidebar-unread-badge {
  position: absolute;
  top: 4px;
  right: 12px;
  margin-right: 0;
  padding: 0;
  width: 16px;
  height: 16px;
  min-width: 16px;
  font-size: 10px;
  border: 2px solid var(--card-bg);
}

.visit-site-btn {
  font-weight: 700;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .visit-site-btn .visit-site-text {
    display: none !important;
  }
  .visit-site-btn {
    padding: 0 !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
  }
}

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

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--text-main);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: right;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.admin-nav-item i {
  font-size: 20px;
  color: var(--text-muted);
  transition: color 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.admin-nav-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.admin-nav-item:hover i {
  color: var(--primary);
  transform: scale(1.1);
}

.admin-nav-item.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 81, 50, 0.25);
}

.admin-nav-item.active i {
  color: #ffffff;
}

.admin-sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  background: var(--card-bg);
}

.admin-main-wrapper {
  margin-right: 220px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-main-wrapper.collapsed {
  margin-right: 78px;
}

.admin-top-bar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  height: 70px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 900;
  box-sizing: border-box;
}

.admin-view-section {
  display: none;
  padding: 28px;
}

.admin-view-section.active {
  display: block;
  animation: fadeInView 0.3s ease;
}

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

/* بطاقات الإحصائيات (Stat Cards) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.stat-info .stat-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.stat-info .stat-label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 700;
  margin-top: 4px;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

/* التجاوب للهواتف */
@media (max-width: 900px) {
  .admin-sidebar {
    width: 78px;
  }
  .admin-sidebar .title-text,
  .admin-sidebar .nav-text {
    display: none;
  }
  .admin-main-wrapper {
    margin-right: 78px;
  }
  .admin-view-section {
    padding: 16px;
  }
}

/* ==========================================================================
   مركز رسائل التوست الفاخرة المضيئة (Top-Center Light Toast Messages)
   ========================================================================== */
#toastContainer, .toast-container {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: auto;
  max-width: calc(100vw - 24px);
}

.toast {
  background: rgba(255, 255, 255, 0.98);
  color: #1e293b;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap !important;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast span {
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast-success {
  background: #f0fdf4 !important;
  color: #15803d !important;
  border: 1.5px solid #86efac !important;
  box-shadow: 0 8px 22px rgba(34, 197, 94, 0.2) !important;
}

.toast-error {
  background: #fef2f2 !important;
  color: #b91c1c !important;
  border: 1.5px solid #fca5a5 !important;
  box-shadow: 0 8px 22px rgba(239, 68, 68, 0.2) !important;
}

.toast-warning {
  background: #fffbeb !important;
  color: #b45309 !important;
  border: 1.5px solid #fde68a !important;
  box-shadow: 0 8px 22px rgba(245, 158, 11, 0.2) !important;
}

.toast-info {
  background: #f0f9ff !important;
  color: #0369a1 !important;
  border: 1.5px solid #7dd3fc !important;
  box-shadow: 0 8px 22px rgba(14, 165, 233, 0.2) !important;
}

/* ==========================================================================
   زر التحدث والمراسلة المباشرة الفلوتنج (Floating Messenger Button & Badges)
   ========================================================================== */

.messenger-fab-btn {
  position: fixed;
  bottom: 24px;
  left: 24px !important;
  right: auto !important;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  box-shadow: 0 6px 18px rgba(21, 128, 103, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  z-index: 95;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.messenger-fab-btn:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 10px 24px rgba(21, 128, 103, 0.45);
}

.sidebar-unread-badge {
  background: var(--danger);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  margin-right: auto;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

/* تبويبات قسم الرسائل (Messages Sub-tabs) */
.msg-sub-tabs {
  display: flex;
  gap: 10px;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 20px;
}

.msg-sub-tab {
  padding: 12px 20px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.msg-sub-tab:hover {
  color: var(--primary);
}

.msg-sub-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--primary-light);
  border-radius: 8px 8px 0 0;
}

/* ==========================================================================
   مقبض السويتش الفاخر (Custom Pill Switch Control)
   ========================================================================== */

.custom-switch-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--card-bg);
  margin-bottom: 14px;
  transition: all 0.2s ease;
}

.custom-switch-btn {
  width: 54px;
  height: 28px;
  background-color: #475569;
  border-radius: 28px;
  border: none;
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25);
  outline: none;
  flex-shrink: 0;
  overflow: hidden;
}

.custom-switch-btn.active {
  background-color: var(--primary, #158067) !important;
}

.custom-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.custom-switch-btn.active .custom-switch-thumb {
  left: 29px;
}

/* ==========================================================================
   صفحة وضع الصيانة الفاخرة (Maintenance Mode Page Styling)
   ========================================================================== */

.maintenance-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #0b1329 0%, #111c38 50%, #061022 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 999999;
  padding: 24px;
  box-sizing: border-box;
  overflow: auto;
}

.maintenance-card {
  max-width: 520px;
  width: 100%;
  background: rgba(30, 45, 84, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  padding: 40px 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  animation: maintenanceAppear 0.5s ease-out forwards;
}

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

.maintenance-logo-container {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 20px;
}

.maintenance-logo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 2;
}

.maintenance-pulse-ring {
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  animation: splashPulse 2.5s infinite ease-in-out;
  z-index: 1;
  opacity: 0.6;
}

.maintenance-title {
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 16px 0;
  line-height: 1.4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.maintenance-desc {
  font-size: 15px;
  color: #cbd5e1;
  line-height: 1.7;
  margin: 0 0 28px 0;
  font-weight: 600;
}

.maintenance-actions {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.maintenance-wa-btn {
  background: #25d366 !important;
  color: #ffffff !important;
  border: none !important;
  padding: 12px 28px !important;
  font-weight: 800 !important;
  font-size: 15px !important;
  border-radius: 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  box-shadow: 0 8px 20px rgba(37, 211, 102, 0.3) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
  text-decoration: none !important;
}

.maintenance-wa-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 12px 28px rgba(37, 211, 102, 0.4) !important;
}

.maintenance-footer {
  font-size: 12px;
  color: #94a3b8;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
  width: 100%;
}

/* منع ظهور الشاشة الترحيبية أو أي أزرار فورياً عند تفعيل وضع الصيانة */
html.is-maintenance-active #splashScreen,
body.is-maintenance-active #splashScreen {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html.is-maintenance-active #maintenanceScreen,
body.is-maintenance-active #maintenanceScreen {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* إلغاء ظهور أي أشرطة تمرير (Scrollbars) نهائياً عند فتح نافذة المراسلة المباشرة */
#visitorMessengerModal {
  overflow: hidden !important;
}

/* ==========================================================================
   شارات وأزرار الحالة والتوفر في لوحة التحكم (Admin Status & Stock Badges)
   ========================================================================== */
.badge-admin-btn {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 10px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

/* 1. التوفر (Stock Badges - Matching Store Colors) */
.badge-stock-available {
  background: #dcfce7 !important;
  color: #15803d !important;
  border-color: #86efac !important;
}
.badge-stock-available:hover {
  background: #bbf7d0 !important;
}

.badge-stock-out {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #fca5a5 !important;
}
.badge-stock-out:hover {
  background: #fecaca !important;
}

/* 2. حالة الظهور في المتجر (Visibility Badges - Distinct Indigo & Muted Colors) */
.badge-vis-visible {
  background: #e0e7ff !important;
  color: #3730a3 !important;
  border-color: #a5b4fc !important;
}
.badge-vis-visible:hover {
  background: #c7d2fe !important;
}

.badge-vis-hidden {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border-color: #cbd5e1 !important;
}
.badge-vis-hidden:hover {
  background: #e2e8f0 !important;
}

/* Dark Mode Overrides */
body.dark-theme .badge-stock-available {
  background: rgba(34, 197, 94, 0.2) !important;
  color: #4ade80 !important;
  border-color: rgba(74, 222, 128, 0.4) !important;
}
body.dark-theme .badge-stock-out {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #f87171 !important;
  border-color: rgba(248, 113, 113, 0.4) !important;
}
body.dark-theme .badge-vis-visible {
  background: rgba(99, 102, 241, 0.2) !important;
  color: #818cf8 !important;
  border-color: rgba(129, 140, 248, 0.4) !important;
}
body.dark-theme .badge-vis-hidden {
  background: rgba(148, 163, 184, 0.15) !important;
  color: #94a3b8 !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
}

#visitorMessengerModal .modal-card {
  overflow: hidden !important;
}
