/* RTE extras — image rows + editor caret lines
   ------------------------------------------------
   This file is loaded on the post page AND inside TinyMCE iframe (via content_css).
*/

.post-body p.rte-caret{
  margin:0;
  padding:0;
  line-height:0.2;
}

.post-body .rte-row{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:flex-start;
  margin:12px 0;
  max-width:100%;
}

.post-body .rte-row > figure.rte-img{
  margin:0 !important;
  padding-inline:0 !important;
  flex:0 0 auto;
  box-sizing:border-box;
}

.post-body .rte-row > figure.rte-img img{
  width:100%;
  height:auto;
  display:block;
  max-width:100%;
}

@media (max-width:680px){
  .post-body .rte-row{
    flex-direction:column;
  }
  .post-body .rte-row > figure.rte-img{
    width:100% !important;
  }
}


/* =========================
   Audio block
   ========================= */
.post-body figure.rte-audio{
  margin:18px 0;
  padding:14px 14px 12px;
  border:1px solid var(--chip-border);
  background:var(--card);
  border-radius:calc(var(--radius) + 6px);
  box-shadow:var(--shadow-2);
}

.post-body figure.rte-audio .rte-audio__player,
.post-body figure.rte-audio audio{
  width:100%;
  display:block;
}

.post-body figure.rte-audio figcaption{
  margin-top:10px;
  font-size:14px;
  opacity:.85;
  text-align:center;
}


/* محاذاة داخل صف الصور (تكون لكل صورة بشكل مستقل) */
.post-body .rte-row > figure.rte-img{
  margin: 0;
}
.post-body .rte-row > figure.rte-img.img-align-right{
  margin-inline-start: auto;
  margin-inline-end: 0;
}
.post-body .rte-row > figure.rte-img.img-align-left{
  margin-inline-start: 0;
  margin-inline-end: auto;
}
.post-body .rte-row > figure.rte-img.img-align-center{
  margin-inline: auto;
}



/* =========================
   FAQ (Accordion) block
   ========================= */
.post-body .rte-faq{
  margin:24px 0;
  border:1px solid var(--chip-border);
  background:var(--card);
  border-radius:calc(var(--radius) + 6px);
  box-shadow:var(--shadow-2);
  overflow:hidden;
}

.post-body .rte-faq__title{
  padding:18px 18px 14px;
  font-size:28px;
  font-weight:800;
  line-height:1.2;
  text-align:center;
  background:var(--soft);
  border-bottom:1px solid var(--chip-border);
}

.post-body .rte-faq__item{
  border-top:1px solid var(--chip-border);
}
.post-body .rte-faq__item:first-of-type{
  border-top:0;
}

.post-body .rte-faq__q{
  cursor:pointer;
  display:block;
  list-style:none;
  position:relative;
  padding:16px 18px;
  padding-inline-end:56px;
  font-weight:800;
  line-height:1.55;
  user-select:none;
  transition:background .15s ease;
}

.post-body .rte-faq__q::-webkit-details-marker{ display:none; }

.post-body .rte-faq__q:hover{
  background:var(--soft);
}

.post-body .rte-faq__q:focus-visible{
  outline:2px solid var(--chip-border);
  outline-offset:-2px;
}

.post-body .rte-faq__q::after{
  content:"";
  position:absolute;
  inset-inline-end:18px;
  top:50%;
  width:11px;
  height:11px;
  border:2px solid currentColor;
  border-left:0;
  border-top:0;
  transform:translateY(-50%) rotate(45deg);
  opacity:.75;
  transition:transform .18s ease, opacity .18s ease;
}

.post-body .rte-faq__item[open] > .rte-faq__q{
  background:var(--soft);
}

.post-body .rte-faq__item[open] > .rte-faq__q::after{
  transform:translateY(-50%) rotate(-135deg);
  opacity:1;
}

@keyframes rteFaqIn{
  from{ opacity:0; transform:translateY(-4px); }
  to{ opacity:1; transform:translateY(0); }
}

.post-body .rte-faq__item[open] > .rte-faq__a{
  animation:rteFaqIn .18s ease;
}

.post-body .rte-faq__a{
  padding:0 18px 18px;
  line-height:1.9;
  opacity:.95;
}

.post-body .rte-faq__a p{
  margin:0 0 12px;
}
.post-body .rte-faq__a p:last-child{
  margin-bottom:0;
}

@media (max-width:680px){
  .post-body .rte-faq__title{ font-size:24px; }
}

/* TinyMCE: اجعل الإجابة ظاهرة وقابلة للتحرير حتى لو كانت <details> مغلقة */
.post-body.mce-content-body details.rte-faq__item:not([open]) > :not(summary){
  display:block !important;
}

/* TinyMCE: اسمح باختيار/تحرير نص السؤال بشكل طبيعي */
.post-body.mce-content-body .rte-faq__q{
  user-select:text;
  cursor:text;
}

/* TinyMCE: زر إضافة سؤال (لا يُصدَّر للنشر) */
.post-body.mce-content-body .rte-faq__addwrap{
  padding:14px 18px 18px;
  border-top:1px dashed var(--chip-border);
  display:flex;
  justify-content:flex-start;
  align-items:center;
}

.post-body.mce-content-body .rte-faq__addbtn{
  appearance:none;
  border:0;
  background:var(--accent);
  color:#fff;
  text-decoration:none;
  border-radius:999px;
  padding:10px 16px;
  font-weight:900;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:10px;
  line-height:1;
  user-select:none;
  box-shadow:0 10px 14px rgba(0,0,0,.12);
  transition:transform .12s ease, filter .12s ease, box-shadow .12s ease;
}

.post-body.mce-content-body .rte-faq__addbtn::before{
  content:"+";
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:22px;
  height:22px;
  border-radius:999px;
  background:rgba(255,255,255,.18);
  font-weight:900;
  line-height:1;
}

.post-body.mce-content-body .rte-faq__addbtn:hover{
  filter:brightness(.98);
  transform:translateY(-1px);
  box-shadow:0 14px 18px rgba(0,0,0,.14);
}

.post-body.mce-content-body .rte-faq__addbtn:active{
  transform:translateY(0);
  box-shadow:0 10px 14px rgba(0,0,0,.12);
}

.post-body.mce-content-body .rte-faq__addbtn:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
}

/* =========================
   Print overrides:
   - لا تعرض URL بجانب الروابط داخل النص
   - اطبع FAQ متوسّع حتى لو كان <details> مغلقًا
   ========================= */
@media print{
  /* لا تطبع (http...) بعد الرابط */
  .post-body a[href^="http"]::after{
    content:"" !important;
    display:none !important;
  }

  /* افتح/أظهر محتوى الـ FAQ حتى لو <details> مغلق */
  .post-body details.rte-faq__item:not([open]) > :not(summary){
    display:block !important;
  }

  /* أخفِ سهم/شيفرون الـ FAQ في الورق */
  .post-body .rte-faq__q::after{
    display:none !important;
  }
  .post-body .rte-faq__q{
    padding-inline-end:18px !important;
  }

  /* حاول منع كسر السؤال+الجواب بين الصفحات */
  .post-body details.rte-faq__item{
    break-inside:avoid !important;
    page-break-inside:avoid !important;
  }
}
