/* ==========================================================================
   HYBRID TAFSIR E-BOOK DRAWER FOR BOOK OF WISDOM VOL 1 (ADR-017)
   Slide-over Reflow Commentary Panel + Header/Cover Entry Pill
   ========================================================================== */

.btn-open-tafsir-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.22), rgba(212, 175, 55, 0.08));
  border: 1px solid rgba(212, 175, 55, 0.48) !important;
  color: #F3D87D !important;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 12px rgba(212, 175, 55, 0.14);
}

.btn-open-tafsir-header:hover {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.34), rgba(212, 175, 55, 0.16));
  border-color: #D4AF37 !important;
  transform: translateY(-1px);
}

.btn-cover-tafsir {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  border: 1px solid rgba(212, 175, 55, 0.45) !important;
  color: #F3D87D !important;
  background: rgba(20, 17, 12, 0.72) !important;
}

.btn-cover-tafsir:hover {
  background: rgba(212, 175, 55, 0.18) !important;
  border-color: #D4AF37 !important;
}

/* Slide-Over Drawer Backdrop & Shell */
.tafsir-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 260;
  background: rgba(6, 6, 5, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: flex-end;
  animation: tafsirFadeIn 0.22s ease;
}

.tafsir-drawer-backdrop[hidden] {
  display: none !important;
}

@keyframes tafsirFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tafsir-drawer-panel {
  width: min(620px, 100vw);
  height: 100%;
  background: #14120E;
  color: #EDE5D5;
  border-left: 1px solid rgba(212, 175, 55, 0.28);
  display: flex;
  flex-direction: column;
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.75);
}

.tafsir-drawer-panel[data-tafsir-theme="parchment"] {
  background: #F6EFE2;
  color: #1F1A14;
}

.tafsir-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.22);
  background: rgba(15, 13, 10, 0.92);
}

.tafsir-drawer-panel[data-tafsir-theme="parchment"] .tafsir-drawer-header {
  background: rgba(246, 239, 226, 0.95);
  border-bottom-color: rgba(139, 101, 20, 0.22);
}

.tafsir-drawer-eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #D4AF37;
}

.tafsir-drawer-panel[data-tafsir-theme="parchment"] .tafsir-drawer-eyebrow {
  color: #8B6508;
}

.tafsir-drawer-heading {
  margin: 2px 0 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
}

.tafsir-drawer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tafsir-tool-pill {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.32);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tafsir-tool-pill:hover {
  border-color: #D4AF37;
  background: rgba(212, 175, 55, 0.15);
}

.tafsir-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.25);
  background: transparent;
  color: inherit;
  font-size: 15px;
  cursor: pointer;
}

/* Body Content */
.tafsir-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 22px 36px;
  font-family: 'Lora', Georgia, serif;
  font-size: 16px;
  line-height: 1.78;
}

.tafsir-drawer-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.18);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
}

.tafsir-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.14);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: #D4AF37;
  font-weight: 700;
  font-size: 11px;
}

.tafsir-drawer-panel[data-tafsir-theme="parchment"] .tafsir-badge {
  color: #8B6508;
}

.tafsir-ch-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 6px;
}

.tafsir-ch-sub {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  opacity: 0.78;
  margin: 0 0 18px;
}

.tafsir-summary-card {
  padding: 15px 18px;
  border-radius: 12px;
  background: rgba(212, 175, 55, 0.08);
  border-left: 3px solid #D4AF37;
  margin-bottom: 20px;
  font-size: 15px;
}

.tafsir-prelim-note {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.28);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 14px;
}

.tafsir-sec-block {
  margin-bottom: 20px;
}

.tafsir-sec-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #D4AF37;
  margin: 0 0 8px;
}

.tafsir-drawer-panel[data-tafsir-theme="parchment"] .tafsir-sec-title {
  color: #8B6508;
}

.tafsir-sec-p {
  margin: 0 0 12px;
}

.tafsir-step-card {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 175, 55, 0.16);
  margin-bottom: 10px;
}

.tafsir-drawer-panel[data-tafsir-theme="parchment"] .tafsir-step-card {
  background: rgba(139, 101, 8, 0.05);
}

.tafsir-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.2);
  color: #D4AF37;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tafsir-crop-card {
  margin: 16px 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.22);
  background: rgba(0, 0, 0, 0.22);
  text-align: center;
}

.tafsir-drawer-panel[data-tafsir-theme="parchment"] .tafsir-crop-card {
  background: rgba(255, 255, 255, 0.65);
}

.tafsir-crop-card img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 8px;
  object-fit: contain;
}

.tafsir-crop-cap {
  margin-top: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  opacity: 0.82;
}

.tafsir-table-wrap {
  overflow-x: auto;
  margin: 14px 0;
}

.tafsir-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12.5px;
}

.tafsir-table th,
.tafsir-table td {
  padding: 8px 10px;
  border: 1px solid rgba(212, 175, 55, 0.22);
  text-align: left;
  vertical-align: top;
}

.tafsir-table th {
  background: rgba(212, 175, 55, 0.14);
  font-weight: 700;
}

.tafsir-synthesis-box {
  margin-top: 22px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.38);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.14), rgba(212, 175, 55, 0.04));
}

.tafsir-synthesis-label {
  display: block;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #D4AF37;
  margin-bottom: 6px;
}

/* Footer Navigation inside Drawer */
.tafsir-drawer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid rgba(212, 175, 55, 0.22);
  background: rgba(15, 13, 10, 0.95);
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.tafsir-drawer-panel[data-tafsir-theme="parchment"] .tafsir-drawer-footer {
  background: rgba(246, 239, 226, 0.96);
}

.tafsir-nav-btn {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.32);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.tafsir-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (max-width: 1023px) {
  .btn-open-tafsir-header {
    width: auto !important;
    min-width: max-content;
    height: 34px;
    padding: 0 10px !important;
    gap: 5px;
    border-radius: 999px;
    white-space: nowrap !important;
    flex-shrink: 0;
  }
  .btn-open-tafsir-header svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }
  .btn-open-tafsir-header .tafsir-label-short {
    display: inline !important;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
  }
  .btn-open-tafsir-header .tafsir-label-extra {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .btn-open-tafsir-header {
    height: 32px;
    padding: 0 8px !important;
    gap: 4px;
  }
  .btn-open-tafsir-header .tafsir-label-short {
    font-size: 11px;
  }
}

@media (max-width: 400px) {
  .btn-open-tafsir-header svg {
    display: none;
  }
  .btn-open-tafsir-header {
    height: 30px;
    padding: 0 7px !important;
  }
}

.reader-screen.is-compact-landscape .btn-open-tafsir-header {
  width: auto !important;
  min-width: max-content;
  height: 30px;
  padding: 0 9px !important;
  gap: 5px;
  border-radius: 999px;
  white-space: nowrap !important;
}

.reader-screen.is-compact-landscape .btn-open-tafsir-header .tafsir-label-short {
  display: inline !important;
  font-size: 11.5px;
  font-weight: 700;
}

.reader-screen.is-compact-landscape .btn-open-tafsir-header .tafsir-label-extra {
  display: none !important;
}

@media (max-width: 768px) {
  .tafsir-drawer-body {
    padding: 18px 18px 34px;
    font-size: 17px;
    line-height: 1.82;
  }
  .tafsir-ch-title {
    font-size: 24px;
  }
}
