/* ================== توسيع شريط الأدوات عند النقر ================== */
.at-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 4px;
  height: auto;
  font-size: 10px;
  padding: 8px;
  border-radius: 12px;
  margin: 20px 0;
  width: auto;
  max-width: 55px; /* العرض المغلق */
  overflow: hidden;
  transition: max-width 0.3s ease-in-out, padding 0.3s ease-in-out;
  position: relative;
}

.at-toolbar.expanded {
  max-width: 450px; /* العرض المفتوح - يمكن تعديله حسب الحاجة */

}

.at-toolbar.rtl { 
  flex-direction: row-reverse; 
}

.at-toolbar .at-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 25px;
  height: 25px;
  border-radius: 6px;
  transition: all 0.18s ease-in-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #333;
  font-size: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.at-toolbar .at-btn:hover {
  background-color: #E3A332;
  color: #fff;
  transform: translateY(2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.at-toolbar .at-btn i {
  font-size: 14px;
  pointer-events: none;
}

.at-toolbar .at-btn.active {
  background-color: #2c3e50;
  color: #fff;
}

/* زر القائمة الرئيسي (هامبورغر) */
.at-toolbar .menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

/* الأزرار الثانوية - مخفية في البداية */
.at-toolbar .secondary-buttons {
  display: flex;
  gap: 4px;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
  pointer-events: none;
}

.at-toolbar.expanded .secondary-buttons {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.at-toolbar.rtl .secondary-buttons {
  transform: translateX(10px);
}

.at-toolbar.rtl.expanded .secondary-buttons {
  transform: translateX(0);
}

/* ================== Responsive Adjustments ================== */
@media (max-width: 768px) {
  .at-toolbar {
    max-width: 48px;
  }
  
  .at-toolbar.expanded {
    max-width: 100%;
    flex-wrap: wrap;
  }
  
  .at-toolbar .at-btn {
    width: 28px;
    height: 28px;
    margin: 2px;
  }
}

/* باقي الأكواد الموجودة سابقاً تبقى كما هي */
/* ================== Top Bar ================== */
/* إصلاح القوائم المنسدلة في التوب بار */
.whb-top-bar {
  position: relative;
  z-index: 1000 !important;
}

.whb-top-bar * {
  position: relative;
  z-index: 1001 !important;
}

.whb-top-bar .sub-menu,
.whb-top-bar .dropdown,
.whb-top-bar .whb-dropdown {
  z-index: 1002 !important;
  position: relative;
}

/* ================== Dark Mode كامل الموقع ================== */
html.at-darkmode,
body.at-darkmode {
  background-color: #232323 !important;
  color: #f0f0f0 !important;
  min-height: 100%;
}

/* إجبار كل الحاويات على الخلفية الداكنة بدون إزالة الصور المهمة */
html.at-darkmode *,
body.at-darkmode * {
  color: inherit !important;
  background-color: #232323 !important;
  background-image: none !important;
}

/* استثناء الصور والفيديوهات داخل المقالات */
body.at-darkmode img,
body.at-darkmode svg,
body.at-darkmode video,
body.at-darkmode iframe,
body.at-darkmode .wd-post-thumb,
body.at-darkmode .entry-header,
body.at-darkmode .wd-post-img,
body.at-darkmode .post-img-wrapp,
body.at-darkmode .wd-fill {
  background-color: transparent !important;
  filter: brightness(0.85) contrast(1.1);
}

/* ================== Grayscale ================== */
body.at-grayscale *:not(.whb-top-bar *):not(img):not(svg):not(video) {
  filter: grayscale(100%) !important;
}

body.at-grayscale img,
body.at-grayscale svg,
body.at-grayscale video,
body.at-grayscale iframe,
body.at-grayscale .at-toolbar,
body.at-grayscale .at-toolbar * {
  filter: none;
}

/* ================== High Contrast ================== */
:root {
  --hc-bg: #000;        /* خلفية أسود */
  --hc-text: #ff0;      /* نص أصفر */
  --hc-link: #0ff;      /* روابط */
  --hc-btn-bg: #000;    /* خلفية الأزرار */
  --hc-btn-color: #ff0; /* نص الأزرار */
  --hc-btn-hover-bg: #ff0;
  --hc-btn-hover-color: #000;
  --hc-sticky-bg: #174058; /* خلفية القائمة الستكي */
}

/* تطبيق High Contrast على كامل HTML و BODY */
html.at-contrast,
body.at-contrast {
  background-color: var(--hc-bg) !important;
  color: var(--hc-text) !important;
  min-height: 100%;
}

/* توريث الخلفية للنصوص والحاويات - باستثناء sticky & toolbar */
html.at-contrast *:not(.hc-sticky):not(.hc-sticky *):not(.at-toolbar):not(.at-toolbar *) ,
body.at-contrast *:not(.hc-sticky):not(.hc-sticky *):not(.at-toolbar):not(.at-toolbar *) {
  background-color: #26292b !important;
  color: inherit !important;
}

/* الروابط */
body.at-contrast a:not(.at-btn) {
  color: var(--hc-link) !important;
}
body.at-contrast a:not(.at-btn):hover {
  color: #fff !important;
}

/* Toolbar */
body.at-contrast .at-toolbar {
  background-color: var(--hc-btn-bg) !important;
  border: 2px solid var(--hc-text) !important;
}

body.at-contrast .at-btn {
  color: var(--hc-btn-color) !important;
  border: 1px solid var(--hc-text) !important;
}

body.at-contrast .at-btn:hover {
  background-color: var(--hc-btn-hover-bg) !important;
  color: var(--hc-btn-hover-color) !important;
}

/* Sticky Menu */
body.at-contrast .hc-sticky,
body.at-contrast .hc-sticky * {
  background-color: var(--hc-sticky-bg) !important;
  background-image: none !important;
  opacity: 1 !important;
  filter: none !important;
  mix-blend-mode: normal !important;
  z-index: 99999 !important;
}

body.at-contrast .hc-sticky a { color: #f1ff06 !important; }
body.at-contrast .hc-sticky a:hover { color: #0ff !important; }

/* ================== Large Text Mode ================== */
body.at-large-text {
  font-size: 120% !important;
}

body.at-large-text h1 {
  font-size: 2.5em !important;
}

body.at-large-text h2 {
  font-size: 2em !important;
}

body.at-large-text h3 {
  font-size: 1.75em !important;
}

body.at-large-text p, 
body.at-large-text li, 
body.at-large-text span, 
body.at-large-text div {
  line-height: 1.8 !important;
}

/* ================== Animation Reduction ================== */
body.at-reduce-animation * {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

body.at-reduce-animation ::before,
body.at-reduce-animation ::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* ================== Responsive Adjustments ================== */
@media (max-width: 768px) {
  .at-toolbar {
    flex-wrap: wrap;
    padding: 10px;
  }
  
  .at-toolbar .at-btn {
    width: 28px;
    height: 28px;
    margin: 2px;
  }
  
  body.at-large-text {
    font-size: 110% !important;
  }
}