/* ─── ePaper RTL Stylesheet (Urdu / Arabic editions) ──────── */
/* Loaded only when edition has rtl=1 in the database          */

/* Urdu font family */
.epaper-app[dir="rtl"],
.epaper-archive[dir="rtl"] {
  font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Nafees Web Naskh',
               'Arial Unicode MS', Tahoma, serif;
  direction: rtl;
}

/* Header — flip layout */
.epaper-app[dir="rtl"] .ep-header__inner {
  flex-direction: row-reverse;
}
.epaper-app[dir="rtl"] .ep-header__actions {
  margin-left: 0;
  margin-right: auto;
}
.epaper-app[dir="rtl"] .ep-editions {
  flex-direction: row-reverse;
}

/* Toolbar — flip left/right groups */
.epaper-app[dir="rtl"] .ep-toolbar {
  flex-direction: row-reverse;
}

/* Layout — thumb strip moves to right, articles panel to left */
.epaper-app[dir="rtl"] .ep-layout {
  flex-direction: row-reverse;
}
.epaper-app[dir="rtl"] .ep-thumbstrip {
  border-right: none;
  border-left: 1px solid var(--ep-sidebar-border, rgba(0,0,0,.08));
}
.epaper-app[dir="rtl"] .ep-articles-panel {
  border-left: none;
  border-right: 1px solid var(--ep-sidebar-border, rgba(0,0,0,.08));
}

/* Page strip — RTL scroll */
.epaper-app[dir="rtl"] .ep-page-strip {
  direction: rtl;
}

/* Article panel text */
.epaper-app[dir="rtl"] .ep-article-item__hl {
  font-size: 13px;
  line-height: 1.8;
  text-align: right;
}
.epaper-app[dir="rtl"] .ep-article-item__meta {
  text-align: right;
}
.epaper-app[dir="rtl"] .ep-articles-panel__header h3 {
  text-align: right;
}

/* Modals */
.epaper-app[dir="rtl"] .ep-modal__header {
  flex-direction: row-reverse;
}
.epaper-app[dir="rtl"] .ep-modal__box {
  direction: rtl;
  font-family: 'Noto Nastaliq Urdu', Tahoma, serif;
}
.epaper-app[dir="rtl"] .ep-art-headline {
  text-align: right;
  font-family: 'Noto Nastaliq Urdu', Tahoma, serif;
  line-height: 2;
}
.epaper-app[dir="rtl"] .ep-art-body {
  text-align: right;
  font-family: 'Noto Nastaliq Urdu', Tahoma, serif;
  line-height: 2.2;
  direction: rtl;
}

/* Calendar */
.epaper-app[dir="rtl"] .ep-cal-nav {
  flex-direction: row-reverse;
}
.epaper-app[dir="rtl"] .ep-cal-nav-btn:first-child::after { content: '›'; }
.epaper-app[dir="rtl"] .ep-cal-nav-btn:last-child::after  { content: '‹'; }
.epaper-app[dir="rtl"] .ep-cal-nav-btn { font-size: 0; }
.epaper-app[dir="rtl"] .ep-cal-nav-btn::after { font-size: 16px; }

/* Logo right-aligned */
.epaper-app[dir="rtl"] .ep-logo-text {
  font-family: 'Noto Nastaliq Urdu', Tahoma, serif;
  font-size: 16px;
}

/* Edition tabs — Urdu pill */
.epaper-app[dir="rtl"] .ep-edition-tab {
  font-family: 'Noto Nastaliq Urdu', Tahoma, serif;
  font-size: 14px;
}

/* Page indicator */
.epaper-app[dir="rtl"] .ep-page-indicator {
  font-family: 'Noto Nastaliq Urdu', Tahoma, serif;
}

/* Loading text */
.epaper-app[dir="rtl"] .ep-loading p,
.epaper-app[dir="rtl"] .ep-error p {
  font-family: 'Noto Nastaliq Urdu', Tahoma, serif;
  direction: rtl;
}

/* ── Archive RTL ─────────────────────────────────────────── */
.epaper-archive[dir="rtl"] .ep-arch-header__inner {
  flex-direction: row-reverse;
}
.epaper-archive[dir="rtl"] .ep-editions {
  flex-direction: row-reverse;
}
.epaper-archive[dir="rtl"] .ep-arch-title,
.epaper-archive[dir="rtl"] .ep-arch-month-title {
  font-family: 'Noto Nastaliq Urdu', Tahoma, serif;
  text-align: right;
  direction: rtl;
}
.epaper-archive[dir="rtl"] .ep-arch-card__info {
  text-align: right;
}
.epaper-archive[dir="rtl"] .ep-arch-card__date,
.epaper-archive[dir="rtl"] .ep-arch-card__edition {
  direction: rtl;
}

/* ── Admin RTL badges ────────────────────────────────────── */
.ep-badge--urdu    { background: #fdf3e7; color: #8B4513; font-family: 'Noto Nastaliq Urdu', Tahoma, serif; }
.ep-badge--new-delhi { background: #e8f5e9; color: #2e7d32; }
.ep-badge--bihar   { background: #e3f2fd; color: #1565c0; }

/* ── Flipbook RTL — mirror page order ───────────────────── */
/* StPageFlip renders left-to-right by default.
   For Urdu RTL we just display pages in standard order
   since newspaper PDFs are typically exported left-to-right
   even for RTL content. The text inside is already RTL.
   If your PDFs are truly RTL-ordered, set:
   .epaper-app[dir="rtl"] #ep-flipbook { transform: scaleX(-1); }
   and also flip .ep-art-crop with the same transform.
*/

/* Force page images to display normally inside RTL container */
.epaper-app[dir="rtl"] #ep-flipbook img,
.epaper-app[dir="rtl"] .ep-thumb-img,
.epaper-app[dir="rtl"] .ep-strip-thumb,
.epaper-app[dir="rtl"] .ep-art-crop {
  direction: ltr;
}

/* ── Responsive RTL ──────────────────────────────────────── */
@media (max-width: 640px) {
  .epaper-app[dir="rtl"] .ep-header__inner {
    flex-wrap: wrap;
    gap: 8px;
  }
  .epaper-app[dir="rtl"] .ep-toolbar {
    flex-wrap: wrap;
  }
}
