/* ==========================================================================
   مقال بلس — الهيدر وشريط التصنيفات والفوتر (كل الموقع)
   للتراجع: احذف الخيار am_design_live من قاعدة البيانات (wp option delete am_design_live)
   ========================================================================== */
:root {
  --q-ink: #10202e; --q-nav: #162d57; --q-main: #0b5ed7; --q-main-d: #0a4bb0; --q-accent: #0b8bff;
  --q-soft: #eaf1ff; --q-line: #e3ebf2; --q-bg: #f4f8fb; --q-text: #3f4d66; --q-muted: #5a6b7c;
}
body #tie-wrapper { background: var(--q-bg) !important; }
body, body button, body input, body select, body textarea { font-family: "IBM Plex Sans Arabic", system-ui, sans-serif; }

/* ---------- الهيدر ---------- */
#tie-wrapper > header {
  background: var(--q-nav) !important; border-top: 0 !important; border-bottom: 3px solid #907e4a;
}
#tie-wrapper > header .container {
  display: flex; align-items: center; gap: 22px; padding: 0 20px; min-height: 74px; float: none; width: auto;
}
#tie-wrapper > header .container::before, #tie-wrapper > header .container::after { display: none; }
#tie-wrapper > header .logo-container { float: none; width: auto; flex: 0 0 auto; padding: 0; }
#tie-wrapper > header .logo-container img { max-height: 46px; width: auto; display: block; }
#tie-wrapper > header .hd-left { float: none; width: auto; flex: 1 1 auto; display: flex; align-items: center; gap: 14px; padding: 0; }
#tie-wrapper > header .hd-seachform { order: 1; float: none; width: auto; flex: 1 1 auto; max-width: none; margin: 0; }
#tie-wrapper > header .hd-seachform form { display: flex; align-items: stretch; margin: 0; }
#tie-wrapper > header .hd-seachform input {
  float: none; flex: 1 1 auto; width: auto; height: 44px; border: 0; border-radius: 0 999px 999px 0; padding: 0 20px;
  font: 600 15px "IBM Plex Sans Arabic", system-ui, sans-serif; color: var(--q-ink); background: #fff !important;
}
#tie-wrapper > header .hd-seachform button {
  float: none; flex: 0 0 auto; width: auto; height: 44px; padding: 0 24px; border: 0; border-radius: 999px 0 0 999px;
  font: 700 15px "IBM Plex Sans Arabic", system-ui, sans-serif; background: var(--q-main) !important; color: #fff; cursor: pointer;
}
#tie-wrapper > header .hd-seachform button:hover { background: var(--q-main-d) !important; }
#tie-wrapper > header .hd--menu { order: 2; float: none; margin: 0; display: flex; gap: 4px; }
#tie-wrapper > header .hd--menu li { float: none; }
#tie-wrapper > header .hd--menu li a {
  padding: 0 16px; line-height: 40px; border-radius: 999px; font: 700 15px "IBM Plex Sans Arabic", system-ui, sans-serif; color: #e3f1f5; transition: background .2s;
}
#tie-wrapper > header .hd--menu li a:hover { background: rgba(255,255,255,.12); color: #fff; }
#tie-wrapper > header .side-aside-nav-icon { order: 3; float: none; margin: 0 0 0 0; line-height: 1; }
#tie-wrapper > header .side-aside-nav-icon a {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; font-size: 22px;
}
#tie-wrapper > header .side-aside-nav-icon a:hover { background: var(--q-accent); }

/* ---------- شريط التصنيفات ---------- */
.am-catbar { background: #fff; border-bottom: 1px solid var(--q-line); box-shadow: 0 6px 20px rgba(16,32,46,.05); }
.am-catbar-in { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.am-catbar-in::-webkit-scrollbar { display: none; }
.am-catbar a {
  flex: 0 0 auto; padding: 13px 15px; font: 700 14.5px/1.4 "IBM Plex Sans Arabic", system-ui, sans-serif; color: var(--q-ink);
  border-bottom: 3px solid transparent; transition: color .2s, border-color .2s, background .2s; white-space: nowrap;
}
.am-catbar a:hover, .am-catbar a.is-cur { color: var(--q-main); border-bottom-color: var(--q-main); background: var(--q-soft); }

/* ---------- الفوتر ---------- */
body .site-footer.dark-skin, body .site-footer .site-info, body .site-info { background: var(--q-ink) !important; }
body .site-footer { border-top: 3px solid #907e4a !important; }
body .site-footer, body .site-footer a, body .site-info a { color: #c7d4e0; }
body .site-footer a:hover { color: #fff; }

/* ---------- تحييد قواعد قديمة في theme.css ---------- */
body .container-wrapper { padding: 24px; }
body .block-head-1 .tie-container .the-global-title:before, body .block-head-1 .widget-title.the-global-title .the-subtitle:before,
body .block-head-1 .widget-title.the-global-title .the-subtitle:after, body .block-head-1 .mag-box-title h3:before, body .block-head-1 .mag-box-title h3:after { display: none; }
body .block-head-1 .mag-box-title h3, body .block-head-1 .widget-title.the-global-title .the-subtitle {
  background: none !important; color: var(--q-ink); margin: 0; padding: 0 12px 0 0; border-right: 4px solid var(--q-accent); line-height: 1.5;
}
[type="submit"], .button, .post-cat, .pages-numbers li.current span { background-color: var(--q-main) !important; }
::selection { background: var(--q-main) !important; color: #fff; }

/* ---------- المقال المفرد: صورة بدون تدرج ولا ارتفاع ثابت ---------- */
.single .featured-area { height: auto !important; border-radius: 16px; overflow: hidden; background: #fff; }
.single .featured-area:before { display: none !important; }
.single .featured-area img { position: static !important; top: auto !important; transform: none !important; width: 100%; height: auto; max-height: 560px; object-fit: contain; }
.single .ft-img--wrap { margin: 0 0 22px; padding-top: 0; }
.single .ft-img--wrap .featured-area + .entry-header-outer, .single .ft-img--wrap .entry-header-outer { position: static; padding: 18px 0 0 !important; }

@media (max-width: 900px) {
  #tie-wrapper > header .container { flex-wrap: wrap; gap: 10px 12px; padding: 10px 14px; min-height: 0; }
  #tie-wrapper > header .logo-container { order: 1; }
  #tie-wrapper > header .hd-left { display: contents; }
  #tie-wrapper > header .side-aside-nav-icon { order: 2; margin-inline-start: auto; }
  #tie-wrapper > header .hd--menu { order: 3; }
  #tie-wrapper > header .hd-seachform { order: 4; flex: 1 1 100%; max-width: none; }
  #tie-wrapper > header .hd--menu li a { padding: 0 12px; font-size: 14px; }
}

/* تغلّب على قواعد «CSS إضافي» القديمة للهيدر */
#tie-wrapper > header .hd-seachform { width: auto !important; margin: 0 !important; }
#tie-wrapper > header .hd-seachform input[type=text] { min-width: 0; flex: 1 1 0; width: 0; border-radius: 0 999px 999px 0 !important; height: 44px; }
#tie-wrapper > header .hd-seachform button { border-radius: 999px 0 0 999px !important; height: 44px; }
#tie-wrapper > header .hd--menu { margin: 0 !important; }
#tie-wrapper > header .hd--menu li a { margin: 0 !important; padding: 0 16px !important; line-height: 40px !important; height: 40px; font-size: 15px !important; font-weight: 600; }
#tie-wrapper > header .logo-container, #tie-wrapper > header .logo-container #logo { background: none !important; box-shadow: none !important; border: 0 !important; }
.am-catbar .am-only-m { display: none; }
@media (max-width: 600px) {
  #tie-wrapper > header .hd--menu { display: none; }
  #tie-wrapper > header .hd-seachform { order: 3; }
  #tie-wrapper > header .side-aside-nav-icon { order: 2; }
  #tie-wrapper > header .logo-container img { max-height: 40px; }
  .am-catbar .am-only-m { display: block; }
}

/* ---------- القائمة الجانبية ---------- */
.side-aside .am-sp { padding: 70px 22px 34px; display: flex; flex-direction: column; gap: 24px; color: #e8eefb; font-family: "IBM Plex Sans Arabic", system-ui, sans-serif; text-align: right; }
.side-aside .am-sp a { text-decoration: none !important; }
.side-aside .am-sp-logo img { max-height: 46px; width: auto; display: block; }
.side-aside .am-sp-search { display: flex; margin: 0; }
.side-aside .am-sp-search input[type=search] { flex: 1 1 0; min-width: 0; height: 46px; border: 0 !important; border-radius: 0 999px 999px 0 !important; padding: 0 18px; font: 500 15px "IBM Plex Sans Arabic", system-ui, sans-serif; background: #fff !important; color: #10202e !important; box-shadow: none !important; }
.side-aside .am-sp-search button { flex: 0 0 auto; height: 46px; padding: 0 22px; border: 0; border-radius: 999px 0 0 999px !important; background: #0b5ed7 !important; color: #fff; font: 700 15px "IBM Plex Sans Arabic", system-ui, sans-serif; cursor: pointer; }
.side-aside .am-sp-search button:hover { background: #0a4bb0 !important; }
.side-aside .am-sp-main { display: grid; gap: 10px; }
.side-aside .am-sp-main a { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-radius: 14px; background: rgba(255,255,255,.09); color: #fff !important; font-size: 17px; font-weight: 700; transition: background .2s, transform .2s; }
.side-aside .am-sp-main a.is-home { background: #0b5ed7; }
.side-aside .am-sp-main a:hover { background: #1f6fe6; transform: translateX(-3px); }
.side-aside .am-sp h3 { margin: 0 0 12px; font-size: 13px; font-weight: 600; letter-spacing: .03em; color: #9fb2d4 !important; background: none !important; border: 0 !important; padding: 0 !important; }
.side-aside .am-sp-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.side-aside .am-sp-cats a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.12); color: #e8eefb !important; font-size: 14px; font-weight: 500; transition: background .2s, border-color .2s; }
.side-aside .am-sp-cats a small { font-size: 11.5px; color: #b9c8e6; background: rgba(255,255,255,.1); border-radius: 999px; padding: 1px 7px; }
.side-aside .am-sp-cats a:hover { background: #0b5ed7; border-color: #0b5ed7; }
.side-aside .am-sp-links { display: flex; flex-direction: column; }
.side-aside .am-sp-links a { padding: 12px 2px; border-bottom: 1px solid rgba(255,255,255,.12); color: #dbe5f7 !important; font-size: 15px; font-weight: 500; }
.side-aside .am-sp-links a:last-child { border-bottom: 0; }
.side-aside .am-sp-links a:hover { color: #fff !important; padding-right: 8px; }
.side-aside .am-sp-social { padding-top: 6px; border-top: 1px solid rgba(255,255,255,.14); }
.side-aside .am-sp-social h3 { margin-top: 18px; }
.side-aside .am-sp-social ul { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.side-aside .am-sp-social a.social-link { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff !important; font-size: 20px; transition: background .2s, transform .2s; }
.side-aside .am-sp-social a.social-link:hover { background: #0b5ed7; transform: translateY(-3px); }

/* ---------- القائمة الجانبية: كل الأقسام (قائمة منسدلة بسيطة) ---------- */
.side-aside .am-sp-tree { display: flex; flex-direction: column; gap: 8px; }
.side-aside .am-sp-tree .am-sp-one, .side-aside .am-sp-tree summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; border-radius: 12px;
  background: rgba(255,255,255,.08); color: #fff !important; font-size: 16px; font-weight: 600; cursor: pointer; list-style: none;
  transition: background .2s;
}
.side-aside .am-sp-tree summary::-webkit-details-marker { display: none; }
.side-aside .am-sp-tree summary::marker { content: ""; }
.side-aside .am-sp-tree .am-sp-one:hover, .side-aside .am-sp-tree summary:hover { background: rgba(255,255,255,.14); }
.side-aside .am-sp-tree summary > span, .side-aside .am-sp-tree .am-sp-one > span { flex: 1 1 auto; }
.side-aside .am-sp-tree summary::after {
  content: ""; flex: 0 0 auto; width: 8px; height: 8px; margin-inline-start: 4px; border-right: 2px solid #b9c8e6; border-bottom: 2px solid #b9c8e6;
  transform: rotate(45deg); transition: transform .2s; margin-top: -3px;
}
.side-aside .am-sp-tree details[open] > summary { background: #0b5ed7; border-radius: 12px 12px 0 0; }
.side-aside .am-sp-tree details[open] > summary::after { transform: rotate(-135deg); margin-top: 3px; border-color: #fff; }
.side-aside .am-sp-tree small { font-size: 11.5px; font-weight: 500; color: #c6d3ee; background: rgba(255,255,255,.12); border-radius: 999px; padding: 1px 8px; flex: 0 0 auto; }
.side-aside .am-sp-kids { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 10px 12px 14px; background: rgba(255,255,255,.05); border-radius: 0 0 12px 12px; }
.side-aside .am-sp-kids a { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 9px 6px; color: #dbe5f7 !important; font-size: 14px; font-weight: 500; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-aside .am-sp-kids a:hover { color: #fff !important; }
.side-aside .am-sp-kids a small { padding: 0 6px; font-size: 11px; }
.side-aside .am-sp-kids .am-sp-all { grid-column: 1 / -1; justify-content: center; margin-bottom: 6px; padding: 10px; border: 0; border-radius: 10px; background: rgba(11,94,215,.55); color: #fff !important; font-weight: 700; font-size: 14.5px; }
.side-aside .am-sp-kids .am-sp-all:hover { background: #0b5ed7; }
@media (max-width: 380px) { .side-aside .am-sp-kids { grid-template-columns: 1fr; } }

/* الشعار في منتصف القائمة الجانبية وبلا فراغ زائد فوقه */
.side-aside .am-sp { padding-top: 58px; gap: 22px; }
.side-aside .am-sp-logo { display: flex; justify-content: center; align-items: center; margin: 0; padding: 0; }
.side-aside .am-sp-logo > div, .side-aside .am-sp-logo a { margin: 0 !important; padding: 0 !important; display: block; float: none !important; text-align: center; }
.side-aside .am-sp-logo img { margin: 0 auto; max-height: 46px; }
/* بلا :has() لتوافق المتصفحات القديمة: نلغي حشوة 50px الأصلية بهامش سالب */
.side-aside .am-sp { padding-top: 54px; margin-top: -50px; }

/* ==========================================================================
   القائمة الرئيسية: أقسام بقوائم منبثقة
   ========================================================================== */
.am-catbar-in { position: relative; display: block; overflow: visible; }
.am-menu { display: flex; align-items: stretch; list-style: none; margin: 0; padding: 0; gap: 0; }
.am-menu > li { flex: 0 0 auto; }
.am-menu > li > a {
  display: flex; align-items: center; gap: 7px; padding: 14px 11px; font: 700 14.5px/1.4 "IBM Plex Sans Arabic", system-ui, sans-serif;
  color: var(--q-ink); border-bottom: 3px solid transparent; background: none; white-space: nowrap; transition: color .2s, background .2s, border-color .2s;
}
.am-menu > li:hover > a, .am-menu > li:focus-within > a, .am-menu > li.is-cur > a { color: var(--q-main); border-bottom-color: var(--q-main); background: var(--q-soft); }
.am-car { width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-top: -3px; opacity: .55; transition: transform .2s; }
.am-menu > li:hover .am-car { transform: rotate(-135deg); margin-top: 3px; }
.am-menu > li.has-dd { position: relative; }
.am-menu > li.has-mega { position: static; }

.am-dd {
  position: absolute; top: 100%; right: 0; z-index: 60; min-width: 270px; background: #fff; border: 1px solid var(--q-line); border-top: 0;
  border-radius: 0 0 16px 16px; box-shadow: 0 22px 44px rgba(16,32,46,.18); opacity: 0; visibility: hidden; transform: translateY(8px); pointer-events: none;
  transition: opacity .18s, transform .18s, visibility .18s;
}
.am-menu > li.dd-left > .am-dd { right: auto; left: 0; }
.am-dd.am-dd-mega { right: 20px; left: 20px; min-width: 0; }
.am-menu > li.has-dd:hover > .am-dd, .am-menu > li.has-dd:focus-within > .am-dd { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
.am-dd-in { padding: 18px 20px 20px; }
.am-catbar .am-dd a {
  display: block; padding: 8px 10px; border: 0; border-radius: 8px; font: 500 14px/1.5 "IBM Plex Sans Arabic", system-ui, sans-serif; color: var(--q-ink); background: none; white-space: normal; transition: background .15s, color .15s;
}
.am-catbar .am-dd a:hover { background: var(--q-soft); color: var(--q-main); }
.am-dd-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 26px; }
.am-dd-col { display: flex; flex-direction: column; gap: 1px; }
.am-catbar .am-dd a.am-dd-t { font-weight: 700; font-size: 15px; color: var(--q-main); padding: 6px 10px 9px; margin-bottom: 4px; border-radius: 0; border-bottom: 2px solid var(--q-soft); }
.am-catbar .am-dd a.am-dd-more { color: var(--q-main); font-weight: 600; font-size: 13px; }
.am-catbar .am-dd a.am-dd-all { text-align: center; font-weight: 700; background: var(--q-soft); color: var(--q-main); margin-bottom: 8px; }
.am-dd-list { display: grid; gap: 1px; }
.am-dd-list.is-two { grid-template-columns: 1fr 1fr; gap: 1px 14px; min-width: 440px; }
.am-menu .am-only-m { display: none; }

@media (max-width: 1200px) { .am-menu > li > a { padding: 14px 8px; font-size: 14px; } }
@media (max-width: 1000px) {
  .am-catbar-in { overflow-x: auto; scrollbar-width: none; }
  .am-menu { width: max-content; }
  .am-menu > li > a { padding: 13px 13px; font-size: 14.5px; }
  .am-menu .am-only-m { display: block; }
  .am-dd, .am-car { display: none !important; }
}

/* ---------- القائمة الجانبية: أقسام عامة داخل القسم الرئيسي ---------- */
.side-aside .am-sp-sub { grid-column: 1 / -1; margin-top: 8px; }
.side-aside .am-sp-kids .am-sp-subt { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border: 0; border-radius: 10px; background: rgba(255,255,255,.1); color: #fff !important; font-weight: 700; font-size: 14.5px; }
.side-aside .am-sp-kids .am-sp-subt:hover { background: rgba(255,255,255,.17); }
.side-aside .am-sp-subk { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; padding: 4px 8px 2px; }
@media (max-width: 380px) { .side-aside .am-sp-subk { grid-template-columns: 1fr; } }
.am-menu > li > .am-dd.am-dd-mega { right: 20px; left: 20px; }

/* ---------- القائمة الرئيسية: لمس وتوافق ---------- */
/* إغلاق متأخر قليلًا حتى لا تُغلق القائمة عند الحركة القطرية للمؤشر */
.am-dd { transition: opacity .18s ease, transform .18s ease, visibility 0s linear .22s; }
.am-menu > li.has-dd:hover > .am-dd, .am-menu > li.has-dd:focus-within > .am-dd, .am-menu > li.has-dd.is-open > .am-dd { transition-delay: 0s; opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
.am-menu > li.is-open > a { color: var(--q-main); border-bottom-color: var(--q-main); background: var(--q-soft); }
.am-menu > li > a:focus-visible, .am-catbar .am-dd a:focus-visible { outline: 2px solid var(--q-main); outline-offset: -2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { .am-dd, .am-car, .am-menu > li > a { transition: none !important; } }

/* جافاسكربت القالب على الجوال يضع ارتفاعًا ثابتًا (style="height:...") على حاوية الهيدر فيقطع صف البحث */
#tie-wrapper > header .container { height: auto !important; }

/* قوائم منبثقة تتسع لخمسة أعمدة على 1024px وتتمرر داخليًا على الشاشات القصيرة */
.am-dd-cols { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 8px 20px; }
.am-dd-in { max-height: calc(100vh - 190px); overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 1100px) { .am-dd.am-dd-mega { right: 8px; left: 8px; } }

/* ---------- الجوال: الأقسام داخل القائمة الجانبية فقط، وشريط التصنيفات مخفي ---------- */
.side-aside .am-sp-mob { display: none; }
@media (max-width: 1000px) {
  .am-catbar { display: none !important; }
  .side-aside .am-sp-mob { display: block; }
}

/* الإعلانات: تختفي الوحدة الفارغة فلا تترك فراغًا */
.am-ad, .am-inline-ad { margin: 18px 0; text-align: center; clear: both; overflow: hidden; }
.am-ad:has(ins.adsbygoogle[data-ad-status="unfilled"]), .am-inline-ad:has(ins.adsbygoogle[data-ad-status="unfilled"]) { display: none !important; }
.am-ad:not(:has(ins[data-ad-status="filled"])), .am-inline-ad:not(:has(ins[data-ad-status="filled"])) { margin: 0; }
.am-ad:has(ins[data-ad-status="filled"])::before, .am-inline-ad:has(ins[data-ad-status="filled"])::before { content: "إعلان"; display: block; font: 600 11px/1 "IBM Plex Sans Arabic", system-ui, sans-serif; color: #7b879d; margin-bottom: 6px; }
