/* layout-core.css — تخطيط عام فقط، بدون ثيمات */

/* إصلاح التخطيط النهائي: قائمة جانبية + محتوى */
html, body {
  height: 100% !important;
  margin: 0 !important;
  overflow-x: hidden !important;
}
#app-wrapper {
  display: flex !important;
  flex-direction: row !important; /* RTL: القائمة يمين */
  align-items: stretch !important;
  width: 100% !important;
  min-height: 100vh !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
  position: relative !important;
  overflow: hidden !important;
}
/* القائمة الجانبية محذوفة — تُستخدم القائمة المنسدلة من الأعلى */
#sidebar, aside#sidebar {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  flex: 0 0 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  position: absolute !important;
  right: -9999px !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
#sidebar.collapsed, #sidebar.royal-mini, #sidebar.hover-open {
  display: none !important;
  width: 0 !important;
}
#main-content {
  flex: 1 1 auto !important;
  position: relative !important;
  margin: 0 !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
  padding: 14px 18px !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
  height: 100vh !important;
  max-height: 100vh !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  box-sizing: border-box !important;
  display: block !important;
}
.section-container.active {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  min-height: 0 !important;
}
.section-container:not(.active) { display: none !important; }
#sidebar .nav-links li[data-section] { display: flex; }
#dashboard .dashboard-cards {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
  gap: 14px !important;
}
/* بطاقات الأرباح والإحصائيات */
#profit-details, #stats-details .st-cards-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
  gap: 12px !important;
}
.royal-stat-card {
  padding: 16px 14px !important;
  border-radius: 16px !important;
  text-align: center !important;
  background: var(--card-bg, #fff) !important;
  border: 1.5px solid rgba(201,168,76,.35) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,.06) !important;
  transition: transform .15s, box-shadow .15s !important;
  cursor: default;
}
.royal-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0,0,0,.1) !important;
}
.royal-stat-card .rsc-label {
  font-size: 12px !important;
  opacity: .75 !important;
  margin-bottom: 8px !important;
  font-weight: 600 !important;
}
.royal-stat-card .rsc-value {
  font-size: 20px !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
}
.royal-stat-card .rsc-hint {
  font-size: 10px !important;
  opacity: .55 !important;
  margin-top: 6px !important;
}
/* أزرار حسب نوع الإجراء */
button.btn-neon[onclick*="openAdd"],
button.btn-neon[onclick*="openReservation"],
button.btn-neon:has(.fa-plus),
button.btn-neon:has(.fa-plus-circle),
button.btn-neon:has(.fa-user-plus) {
  background: linear-gradient(135deg, #C9A84C, #b8942f) !important;
  border-color: #C9A84C !important;
  color: #111 !important;
}
button.btn-neon[onclick*="export"],
button.btn-neon:has(.fa-file-excel) {
  background: linear-gradient(135deg, #1e8449, #27ae60) !important;
  border-color: #27ae60 !important;
  color: #fff !important;
}
button.btn-neon[onclick*="import"],
button.btn-neon:has(.fa-file-import) {
  background: linear-gradient(135deg, #1a5276, #2980b9) !important;
  border-color: #2980b9 !important;
  color: #fff !important;
}
button.btn-neon[onclick*="print"],
button.btn-neon[onclick*="Print"],
button.btn-neon:has(.fa-print) {
  background: linear-gradient(135deg, #0e6655, #16a085) !important;
  border-color: #16a085 !important;
  color: #fff !important;
}
button.btn-neon[onclick*="Pdf"],
button.btn-neon[onclick*="pdf"],
button.btn-neon:has(.fa-file-pdf) {
  background: linear-gradient(135deg, #922b21, #c0392b) !important;
  border-color: #c0392b !important;
  color: #fff !important;
}
button.btn-neon[onclick*="delete"],
button.btn-neon[onclick*="openReturn"],
button.btn-neon:has(.fa-trash),
button.btn-neon:has(.fa-undo) {
  background: linear-gradient(135deg, #c0392b, #e74c3c) !important;
  border-color: #c0392b !important;
  color: #fff !important;
}
button.btn-neon:has(.fa-dolly) {
  background: linear-gradient(135deg, #6c3483, #8e44ad) !important;
  border-color: #8e44ad !important;
  color: #fff !important;
}
button.btn-neon[onclick*="generateReport"],
button.btn-neon[onclick*="Report"],
button.btn-neon:has(.fa-chart-pie),
button.btn-neon:has(.fa-file-alt) {
  background: linear-gradient(135deg, #6c3483, #8e44ad) !important;
  border-color: #8e44ad !important;
  color: #fff !important;
}
#quick-add-payment, .royal-pay-btn,
button.btn-neon:has(.fa-hand-holding-usd) {
  background: linear-gradient(135deg, #148f77, #1abc9c) !important;
  border-color: #1abc9c !important;
  color: #fff !important;
  display: inline-flex !important;
}
@media (max-width: 900px) {
  #app-wrapper { flex-direction: column !important; overflow: auto !important; }
  #sidebar {
    position: fixed !important;
    right: 0 !important; top: 0 !important;
    transform: translateX(110%) !important;
    transition: transform .25s ease !important;
    width: 260px !important;
    max-width: 85vw !important;
    min-width: 0 !important;
    flex: none !important;
    height: 100vh !important;
    z-index: 3000 !important;
    border-radius: 0 !important;
  }
  #sidebar.mobile-open { transform: translateX(0) !important; }
  #main-content {
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    min-height: 100vh !important;
    padding: 12px !important;
  }
}

/* ===== تطوير شكل القائمة الجانبية ===== */
#sidebar {
  background: linear-gradient(185deg, #12121f 0%, #1a1a2e 45%, #16213e 100%) !important;
  border: 1px solid rgba(201,168,76,0.18) !important;
  box-shadow:
    0 12px 40px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.04) !important;
  padding: 14px 10px 12px !important;
  backdrop-filter: blur(8px);
}

#sidebar::before {
  content: "";
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #C9A84C, #e8d48b, #C9A84C, transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  pointer-events: none;
}

.sidebar-brand-box {
  background: linear-gradient(135deg, rgba(201,168,76,0.12), rgba(255,255,255,0.03)) !important;
  border: 1px solid rgba(201,168,76,0.28) !important;
  border-radius: 14px !important;
  padding: 12px 14px !important;
  margin-bottom: 12px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  position: relative;
  overflow: hidden;
}
.sidebar-brand-box::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 50%, rgba(201,168,76,0.1), transparent 60%);
  pointer-events: none;
}
.sidebar-brand-box .brand-logo-img {
  max-height: 38px !important;
  border-radius: 10px;
  filter: drop-shadow(0 2px 6px rgba(201,168,76,0.25));
}
.brand-text span:first-child {
  font-size: 16px !important;
  font-weight: 800 !important;
  background: linear-gradient(135deg, #e8d48b, #C9A84C);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.3px;
}
.brand-text span:last-child {
  font-size: 10.5px !important;
  color: rgba(255,255,255,0.45) !important;
  font-weight: 500;
}

.nav-category-title {
  font-size: 10px !important;
  font-weight: 800 !important;
  letter-spacing: 1.5px !important;
  color: rgba(201,168,76,0.55) !important;
  margin: 14px 12px 6px 0 !important;
  padding-right: 4px;
  position: relative;
}
.nav-category-title::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 2px;
  background: #C9A84C;
  border-radius: 2px;
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0.7;
}

.sidebar-divider {
  height: 1px !important;
  background: linear-gradient(90deg, transparent, rgba(201,168,76,0.25), transparent) !important;
  margin: 10px 8px !important;
  border: none;
}

.nav-links {
  gap: 2px;
  padding: 0 2px !important;
}
.nav-links::-webkit-scrollbar { width: 3px; }
.nav-links::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #C9A84C, #a88b3a);
  border-radius: 10px;
}
.nav-links::-webkit-scrollbar-track { background: transparent; }

.nav-links li {
  padding: 11px 14px !important;
  margin: 2px 0 !important;
  border-radius: 12px !important;
  color: rgba(255,255,255,0.72) !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  gap: 12px !important;
  border: 1px solid transparent;
  position: relative;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.nav-links li i {
  font-size: 16px !important;
  min-width: 26px !important;
  width: 26px;
  height: 26px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  transition: all 0.22s ease;
}
.nav-links li span {
  margin-right: 0 !important;
  letter-spacing: 0.2px;
}

/* Hover */
.nav-links li:hover {
  background: rgba(201,168,76,0.1) !important;
  color: #e8d48b !important;
  border-color: rgba(201,168,76,0.15);
  transform: translateX(-3px);
}
.nav-links li:hover i {
  background: rgba(201,168,76,0.2);
  color: #C9A84C;
  box-shadow: 0 0 12px rgba(201,168,76,0.2);
}

/* Active */
.nav-links li.active {
  background: linear-gradient(135deg, #C9A84C 0%, #b8943f 50%, #a88b3a 100%) !important;
  color: #1a1a2e !important;
  font-weight: 800 !important;
  border-color: rgba(255,255,255,0.15);
  box-shadow:
    0 4px 16px rgba(201,168,76,0.4),
    inset 0 1px 0 rgba(255,255,255,0.25);
  transform: none;
}
.nav-links li.active i {
  background: rgba(0,0,0,0.15);
  color: #1a1a2e;
  box-shadow: none;
}
.nav-links li.active span {
  color: #1a1a2e;
}

/* تسجيل الخروج */
.nav-links li[onclick*="logout"] {
  color: #e74c3c !important;
  margin-top: 4px !important;
}
.nav-links li[onclick*="logout"]:hover {
  background: rgba(231,76,60,0.12) !important;
  color: #ff6b5a !important;
  border-color: rgba(231,76,60,0.2);
  transform: translateX(-3px);
}
.nav-links li[onclick*="logout"] i {
  background: rgba(231,76,60,0.12);
  color: #e74c3c;
}

/* Collapsed state */
#sidebar.collapsed .nav-links li {
  justify-content: center !important;
  padding: 12px !important;
  border-radius: 12px !important;
}
#sidebar.collapsed .nav-links li:hover {
  transform: scale(1.06);
}
#sidebar.collapsed .nav-links li i {
  min-width: 28px !important;
  width: 28px;
  height: 28px;
}

/* زر الطي */
.sidebar-collapse-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  transition: all 0.2s ease;
}
.sidebar-collapse-btn:hover {
  background: rgba(201,168,76,0.2) !important;
  color: #C9A84C !important;
  border-color: rgba(201,168,76,0.3) !important;
}

/* توافق التخطيط */
#app-wrapper {
  display: flex !important;
  flex-direction: row !important; /* RTL: القائمة يمين */
  min-height: 100vh;
}
#sidebar {
  position: relative !important;
  right: auto !important;
  top: auto !important;
  height: 100vh !important;
  flex: 0 0 auto !important;
  width: var(--sidebar-width, 240px);
  border-radius: 0 !important;
  max-height: 100vh;
  transition: width 0.25s ease, min-width 0.25s ease, max-width 0.25s ease;
}
#main-content {
  flex: 1 1 auto !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
  min-width: 0 !important;
  width: auto !important;
  transition: margin 0.25s ease;
}

@media (max-width: 900px) {
  #sidebar {
    position: fixed !important;
    right: 0 !important;
    top: 0 !important;
    height: 100vh !important;
    z-index: 300 !important;
    transform: translateX(105%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1) !important;
    border-radius: 16px 0 0 16px !important;
  }
  #sidebar.mobile-open {
    transform: translateX(0) !important;
  }
}

/* قتل نهائي للقائمة الجانبية */
html body #sidebar, html body aside#sidebar, #sidebar.collapsed, #sidebar.royal-mini,
#sidebar.royal-pinned, #sidebar.royal-unpinned, #sidebar.hover-open, #sidebar.mobile-open {
  display: none !important; width: 0 !important; min-width: 0 !important; max-width: 0 !important;
  flex: 0 0 0 !important; height: 0 !important; max-height: 0 !important;
  opacity: 0 !important; visibility: hidden !important; pointer-events: none !important;
  position: fixed !important; right: -10000px !important; left: auto !important;
  overflow: hidden !important; margin: 0 !important; padding: 0 !important; border: none !important;
  transform: none !important; box-shadow: none !important;
}
html body #main-content, html body #app-wrapper #main-content {
  margin-right: 0 !important; margin-left: 0 !important; width: 100% !important; flex: 1 1 auto !important;
}
#btn-open-nav { display: inline-flex !important; }


/* ===== عزل ألوان الأزرار: الثيمات الأخرى تتجاوز layout-core ===== */
html[data-royal-shape="glass"] button.btn-neon[onclick*="openAdd"],
html[data-royal-shape="glass"] button.btn-neon[onclick*="openReservation"],
html[data-royal-shape="glass"] button.btn-neon:has(.fa-plus),
html[data-royal-shape="glass"] button.btn-neon:has(.fa-plus-circle),
html[data-royal-shape="glass"] button.btn-neon:has(.fa-user-plus),
html[data-royal-shape="glass"] button.btn-neon[onclick*="export"],
html[data-royal-shape="glass"] button.btn-neon:has(.fa-file-excel),
html[data-royal-shape="glass"] button.btn-neon[onclick*="import"],
html[data-royal-shape="glass"] button.btn-neon:has(.fa-file-import),
html[data-royal-shape="glass"] button.btn-neon[onclick*="print"],
html[data-royal-shape="glass"] button.btn-neon[onclick*="Print"],
html[data-royal-shape="glass"] button.btn-neon:has(.fa-print),
html[data-royal-shape="glass"] button.btn-neon[onclick*="Pdf"],
html[data-royal-shape="glass"] button.btn-neon[onclick*="pdf"],
html[data-royal-shape="glass"] button.btn-neon:has(.fa-file-pdf),
html[data-royal-shape="glass"] button.btn-neon[onclick*="delete"],
html[data-royal-shape="glass"] button.btn-neon[onclick*="openReturn"],
html[data-royal-shape="glass"] button.btn-neon:has(.fa-trash),
html[data-royal-shape="glass"] button.btn-neon:has(.fa-undo),
html[data-royal-shape="glass"] button.btn-neon[onclick*="generateReport"],
html[data-royal-shape="glass"] button.btn-neon[onclick*="Report"],
html[data-royal-shape="glass"] button.btn-neon:has(.fa-chart-pie),
html[data-royal-shape="glass"] button.btn-neon:has(.fa-file-alt),
html[data-royal-shape="glass"] #quick-add-payment,
html[data-royal-shape="glass"] .royal-pay-btn,
html[data-royal-shape="glass"] button.btn-neon:has(.fa-hand-holding-usd) {
  background: rgba(255,255,255,0.55) !important;
  color: #2a2a4a !important;
  border: 1.5px solid rgba(140,120,200,0.35) !important;
  box-shadow: 0 4px 16px rgba(100,80,180,0.12) !important;
}

html[data-royal-shape="futuristic"] button.btn-neon[onclick*="openAdd"],
html[data-royal-shape="futuristic"] button.btn-neon[onclick*="openReservation"],
html[data-royal-shape="futuristic"] button.btn-neon:has(.fa-plus),
html[data-royal-shape="futuristic"] button.btn-neon:has(.fa-plus-circle),
html[data-royal-shape="futuristic"] button.btn-neon:has(.fa-user-plus),
html[data-royal-shape="futuristic"] button.btn-neon[onclick*="export"],
html[data-royal-shape="futuristic"] button.btn-neon:has(.fa-file-excel),
html[data-royal-shape="futuristic"] button.btn-neon[onclick*="import"],
html[data-royal-shape="futuristic"] button.btn-neon:has(.fa-file-import),
html[data-royal-shape="futuristic"] button.btn-neon[onclick*="print"],
html[data-royal-shape="futuristic"] button.btn-neon[onclick*="Print"],
html[data-royal-shape="futuristic"] button.btn-neon:has(.fa-print),
html[data-royal-shape="futuristic"] button.btn-neon[onclick*="Pdf"],
html[data-royal-shape="futuristic"] button.btn-neon[onclick*="pdf"],
html[data-royal-shape="futuristic"] button.btn-neon:has(.fa-file-pdf),
html[data-royal-shape="futuristic"] button.btn-neon[onclick*="delete"],
html[data-royal-shape="futuristic"] button.btn-neon[onclick*="openReturn"],
html[data-royal-shape="futuristic"] button.btn-neon:has(.fa-trash),
html[data-royal-shape="futuristic"] button.btn-neon:has(.fa-undo),
html[data-royal-shape="futuristic"] button.btn-neon[onclick*="generateReport"],
html[data-royal-shape="futuristic"] button.btn-neon[onclick*="Report"],
html[data-royal-shape="futuristic"] button.btn-neon:has(.fa-chart-pie),
html[data-royal-shape="futuristic"] button.btn-neon:has(.fa-file-alt),
html[data-royal-shape="futuristic"] #quick-add-payment,
html[data-royal-shape="futuristic"] .royal-pay-btn,
html[data-royal-shape="futuristic"] button.btn-neon:has(.fa-hand-holding-usd) {
  background: rgba(0, 30, 55, 0.85) !important;
  color: #00e5ff !important;
  border: 1.5px solid rgba(0, 229, 255, 0.45) !important;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.15) !important;
}

/* لون مميز حسب نوع الزر — futuristic */
html[data-royal-shape="futuristic"] button.btn-neon[onclick*="delete"],
html[data-royal-shape="futuristic"] button.btn-neon[onclick*="openReturn"],
html[data-royal-shape="futuristic"] button.btn-neon:has(.fa-trash),
html[data-royal-shape="futuristic"] button.btn-neon:has(.fa-undo) {
  color: #ff5c7a !important;
  border-color: rgba(255, 92, 122, 0.5) !important;
}
html[data-royal-shape="futuristic"] button.btn-neon[onclick*="export"],
html[data-royal-shape="futuristic"] button.btn-neon:has(.fa-file-excel) {
  color: #00ff9d !important;
  border-color: rgba(0, 255, 157, 0.5) !important;
}
html[data-royal-shape="futuristic"] #quick-add-payment,
html[data-royal-shape="futuristic"] .royal-pay-btn {
  color: #00ff9d !important;
  border-color: rgba(0, 255, 157, 0.55) !important;
}

/* لون مميز حسب نوع الزر — glass */
html[data-royal-shape="glass"] button.btn-neon[onclick*="delete"],
html[data-royal-shape="glass"] button.btn-neon[onclick*="openReturn"],
html[data-royal-shape="glass"] button.btn-neon:has(.fa-trash),
html[data-royal-shape="glass"] button.btn-neon:has(.fa-undo) {
  color: #f07090 !important;
  border-color: rgba(240, 112, 144, 0.45) !important;
}
html[data-royal-shape="glass"] button.btn-neon[onclick*="export"],
html[data-royal-shape="glass"] button.btn-neon:has(.fa-file-excel) {
  color: #3dcf9a !important;
  border-color: rgba(61, 207, 154, 0.45) !important;
}
html[data-royal-shape="glass"] #quick-add-payment,
html[data-royal-shape="glass"] .royal-pay-btn {
  color: #3dcf9a !important;
  border-color: rgba(61, 207, 154, 0.5) !important;
}

/* ===== حماية أيقونات Font Awesome — لا تُستبدل بخط Cairo ===== */
.fa, .fas, .far, .fal, .fad, .fab, .fa-solid, .fa-regular, .fa-brands,
i.fa, i.fas, i.far, i.fab, i[class*="fa-"] {
  font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
  font-style: normal !important;
  font-variant: normal !important;
  text-rendering: auto !important;
  -webkit-font-smoothing: antialiased !important;
  display: inline-block !important;
  line-height: 1 !important;
}
.fas, .fa-solid, i.fas, i.fa-solid { font-weight: 900 !important; }
.far, .fa-regular, i.far, i.fa-regular { font-weight: 400 !important; }
.fab, .fa-brands, i.fab, i.fa-brands { font-family: "Font Awesome 6 Brands" !important; font-weight: 400 !important; }
