/* Accordion TOC - Harmony style (RTL-friendly) */

/* الحاوية */
.atp-toc{
  --atp-bg: #0f172a;                 /* خلفية كارد داكنة */
  --atp-border: rgba(255,255,255,.10);
  --atp-shadow: 0 12px 34px rgba(0,0,0,.28);
  --atp-radius: 16px;

  --atp-text: #ffffff;              /* ✅ كل النص أبيض */
  --atp-text-muted: rgba(255,255,255,.75);
  --atp-line: rgba(255,255,255,.22);

  margin: 18px 0 26px;
  border: 1px solid var(--atp-border);
  border-radius: var(--atp-radius);
  background: var(--atp-bg);
  box-shadow: var(--atp-shadow);
  overflow: hidden;

  color: var(--atp-text);           /* ✅ يضمن أن النص داخل الكارد أبيض */
}

/* زر الفتح/الإغلاق */
.atp-toggle{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;

  border: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,0));
  font: inherit;

  color: var(--atp-text);           /* ✅ */
}

.atp-toggle:focus{
  outline: none;
}

.atp-toggle-text{
  font-weight: 800;
  letter-spacing: .2px;
  color: var(--atp-text);           /* ✅ */
}

/* دائرة الأيقونة */
.atp-toggle-icon{
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--atp-border);
  display: grid;
  place-items: center;
  position: relative;
  flex: 0 0 auto;
  background: rgba(255,255,255,.06);
}

.atp-toggle-icon::before{
  content: "";
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--atp-text); /* ✅ */
  border-bottom: 2px solid var(--atp-text);/* ✅ */
  transform: rotate(45deg);
  transition: transform .22s ease;
}

.atp-toc.is-open .atp-toggle-icon::before{
  transform: rotate(-135deg);
}

/* لوحة المحتويات */
.atp-panel{
  padding: 4px 8px 14px;
}

/* القائمة */
.atp-list{
  margin: 0;
  padding: 8px 14px 0 28px;
  counter-reset: atp-h2;
}

/* عناصر القائمة */
.atp-list li{
  margin: 10px 0;
  line-height: 1.6;
}

/* ✅ إصلاح underline + تكبير مساحة الضغط + النص أبيض */
.atp-list li > a{
  color: var(--atp-text) !important;           /* ✅ */
  text-decoration: none !important;            /* ✅ يكسر ستايل المتصفح */
  border-bottom: 1px dashed var(--atp-line);
  display: block;                               /* ✅ السطر كامل قابل للضغط */
  padding: 6px 0;                               /* ✅ */
  transition: border-bottom-color .2s ease, transform .08s ease;
}

.atp-list li > a:hover{
  border-bottom-style: solid;
}

.atp-list li > a:active{
  transform: translateY(1px);
}

/* H2: ترقيم + وزن أعلى */
.atp-list li.atp-h2{
  counter-increment: atp-h2;
  font-weight: 750;
  color: var(--atp-text);                       /* ✅ */
}

.atp-list li.atp-h2 > a::before{
  content: counter(atp-h2) ". ";
  color: var(--atp-text-muted);                 /* ✅ */
}

/* H3: إزاحة + نقطة */
.atp-list li.atp-h3{
  margin-top: 6px;
  margin-inline-start: 16px;
  font-weight: 600;
  color: var(--atp-text);                       /* ✅ */
}

.atp-list li.atp-h3 > a::before{
  content: "• ";
  color: var(--atp-text-muted);                 /* ✅ */
}

/* رسالة عدم وجود عناوين */
.atp-empty{
  margin: 10px 14px 0;
  color: var(--atp-text-muted);                 /* ✅ */
  font-size: .95em;
}

/* تحسينات موبايل */
@media (max-width: 480px){
  .atp-toggle{ padding: 14px 14px; }
  .atp-list{ padding: 8px 12px 0 24px; }
}
