/* ==========================================================================
   PDF Export Button & Print Styles
   Muawiyah Theme — Export clean article view
   ========================================================================== */

/* PDF Export Button */
.export-pdf-btn {
  position: fixed;
  top: 120px;
  left: 20px;
  z-index: 1000;
  padding: 12px 18px;
  background: var(--mu-green);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Cairo', 'Noto Naskh Arabic', sans-serif;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.export-pdf-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  background: var(--mu-green-deep);
}

.export-pdf-btn:active {
  transform: scale(0.98);
}

html[data-theme="dark"] .export-pdf-btn {
  background: var(--mu-gold);
  color: var(--ink);
}

html[data-theme="dark"] .export-pdf-btn:hover {
  background: #d4a849;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .export-pdf-btn {
    position: static;
    display: block;
    margin: 16px auto;
    width: calc(100% - 32px);
    max-width: 300px;
  }
}

/* ==========================================================================
   Print Styles — Article Only
   ========================================================================== */

@media print {
  /* Hide everything except the article content */
  .no-print,
  .export-pdf-btn,
  .header,
  .nav,
  .sidebar,
  .footer,
  .share-buttons,
  .breadcrumb,
  .comments-wrap,
  .related-posts,
  .post-full-actions,
  .audio-reader-container,
  .audio-reader-wrapper,
  .audio-reader,
  .translate-button,
  .paywall,
  aside,
  nav,
  header.site-header,
  footer.site-footer,
  .mobile-quicknav,
  button,
  .refs {
    display: none !important;
  }

  /* Reset page margins and setup */
  @page {
    margin: 2cm;
    size: A4;
  }

  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    direction: rtl;
    text-align: right;
  }

  /* Container adjustments */
  .container {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .layout {
    display: block !important;
  }

  /* Article content styling */
  .article.content,
  .printable-content {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    border: none !important;
  }

  /* Article header */
  .article-head {
    margin-bottom: 30px;
    page-break-after: avoid;
  }

  .article-title {
    font-size: 24pt !important;
    color: #000000 !important;
    margin-bottom: 12pt;
    line-height: 1.3;
  }

  .article-byline {
    font-size: 10pt !important;
    color: #666666 !important;
    margin-bottom: 20pt;
  }

  /* Article body */
  .article-body {
    font-size: 12pt !important;
    line-height: 1.8;
    color: #000000 !important;
  }

  .article-body h2 {
    font-size: 18pt !important;
    color: #000000 !important;
    margin-top: 24pt;
    margin-bottom: 12pt;
    page-break-after: avoid;
  }

  .article-body h3 {
    font-size: 14pt !important;
    color: #000000 !important;
    margin-top: 18pt;
    margin-bottom: 10pt;
    page-break-after: avoid;
  }

  .article-body p {
    margin: 10pt 0;
    text-align: justify;
    orphans: 3;
    widows: 3;
  }

  .article-body ul,
  .article-body ol {
    margin: 10pt 0;
    padding-right: 20pt;
  }

  .article-body li {
    margin: 6pt 0;
  }

  /* Blockquotes */
  .article-body blockquote {
    border-right: 3pt solid #666666;
    padding: 8pt 12pt;
    margin: 16pt 0;
    background: #f5f5f5 !important;
    page-break-inside: avoid;
  }

  /* Images */
  .post-thumb,
  .article-body img {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid;
    margin: 12pt 0;
  }

  /* Tables */
  .article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 16pt 0;
    font-size: 10pt;
    page-break-inside: avoid;
  }

  .article-body th,
  .article-body td {
    border: 1pt solid #000000;
    padding: 6pt;
    text-align: right;
  }

  .article-body th {
    background: #f0f0f0 !important;
    font-weight: bold;
  }

  /* Tags */
  .post-tags,
  .article-tags {
    margin: 10pt 0;
    font-size: 9pt;
    color: #666666 !important;
  }

  /* Code blocks */
  .article-body pre,
  .article-body code {
    background: #f5f5f5 !important;
    border: 1pt solid #cccccc;
    padding: 4pt;
    font-size: 9pt;
    page-break-inside: avoid;
  }

  /* Links */
  .article-body a {
    color: #000000 !important;
    text-decoration: underline;
  }

  .article-body a[href]:after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666666;
  }

  /* Footnotes */
  .footnotes {
    margin-top: 30pt;
    padding-top: 20pt;
    border-top: 1pt solid #cccccc;
    font-size: 9pt;
    page-break-before: auto;
  }

  /* Page breaks */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }

  img, figure, table, blockquote {
    page-break-inside: avoid;
  }

  /* Print URL at bottom */
  .article-body:after {
    content: "المصدر: " attr(data-url);
    display: block;
    margin-top: 30pt;
    padding-top: 20pt;
    border-top: 1pt solid #cccccc;
    font-size: 9pt;
    color: #666666;
    text-align: center;
  }

  /* Clean up any remaining Ghost/theme elements */
  .kg-card,
  .kg-bookmark-card {
    page-break-inside: avoid;
  }

  .kg-bookmark-thumbnail {
    display: none;
  }

  /* Ensure RTL direction is preserved */
  * {
    direction: rtl !important;
    text-align: right !important;
  }

  *[dir="ltr"] {
    direction: ltr !important;
    text-align: left !important;
  }
}

/* Print preview styles (when @media print is active) */
@media print {
  /* Add watermark or footer if needed */
  @page {
    @bottom-right {
      content: "مجلة معاوية بن أبي سفيان";
      font-size: 9pt;
      color: #999999;
    }
  }
}
