/* ═══════════════════════════════════════════════════════════════════════════
   DocuCore Viewer — Exam-Trove / Scribd-style layout
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --dc-yellow:  #f5c518;
  --dc-black:   #1a1a1a;
  --dc-dark:    #111111;
  --dc-blue:    #1a73e8;
  --dc-blue-d:  #1558b0;
  --dc-green:   #16a34a;
  --dc-green-d: #15803d;
  --dc-grey-bd: #e0e0e0;
  --dc-grey-bg: #f5f5f5;
  --dc-white:   #ffffff;
}

/* ── 3-column layout ──────────────────────────────────────────────────────── */
.dp-doc-page {
  display: grid;
  grid-template-columns: 220px 1fr 280px;
  gap: 0;
  min-height: 100vh;
  background: var(--dc-grey-bg);
  align-items: start;
  position: relative;
  z-index: 0; /* Keep below theme's mobile nav / fixed header */
}

/* LEFT sidebar */
.dp-doc-page__left {
  background: var(--dc-white);
  border-right: 1px solid var(--dc-grey-bd);
  padding: 16px 14px;
  min-height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 0;
  max-height: 100vh;
}

/* CENTER viewer */
.dp-doc-page__center {
  background: #525659;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* RIGHT sidebar */
.dp-doc-page__right {
  background: var(--dc-white);
  border-left: 1px solid var(--dc-grey-bd);
  padding: 16px;
  min-height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 0;
  max-height: 100vh;
}

/* ── READING PROGRESS — top of left sidebar ──────────────────────────────── */
.dp-progress-wrap {
  margin-bottom: 14px;
  padding: 10px 12px;
  background: #f8f9fa;
  border: 1px solid var(--dc-grey-bd);
  border-radius: 6px;
}
.dp-progress__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.dp-progress__heading {
  font-size: 11px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.dp-progress__label {
  font-size: 11px;
  font-weight: 700;
  color: var(--dc-black);
}
.dp-progress-bar {
  height: 5px;
  background: #e0e0e0;
  border-radius: 99px;
  overflow: hidden;
}
.dp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  border-radius: 99px;
  transition: width .5s ease;
  width: 0%;
}
.dp-progress-bar.dp-progress--completed .dp-progress-fill {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

/* ── AD BLOCK slot — left sidebar ────────────────────────────────────────── */
.dc-ad-slot {
  border: 1px solid var(--dc-grey-bd);
  border-radius: 6px;
  background: #fafafa;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  overflow: hidden;
}

/* ── DOWNLOAD BUTTON — full width green ─────────────────────────────────── */
.dp-doc-page__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

/* 2-column grid for Save / Like / Dislike / Share */
.dp-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* Base style for the small 2×2 action buttons */
.dp-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 9px 6px;
  border: 1px solid var(--dc-grey-bd);
  border-radius: 8px;
  background: var(--dc-white);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  text-decoration: none;
  color: #444;
  font-size: 12px;
  gap: 3px;
  min-height: 58px;
  width: 100%;
}
.dp-action-btn:hover { background: #f5f5f5; border-color: #bbb; }

/* Full-width green Download button — declared AFTER .dp-action-btn so it wins */
.dp-action-btn--download {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 11px 16px;
  background: var(--dc-green) !important;
  border: none !important;
  border-radius: 6px;
  color: var(--dc-white) !important;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
  box-sizing: border-box;
}
.dp-action-btn--download:hover,
.dp-action-btn--download:focus { background: var(--dc-green-d) !important; color: var(--dc-white) !important; }
.dp-action-btn--download .dp-action-btn__icon  { font-size: 16px; line-height: 1; }
.dp-action-btn--download .dp-action-btn__label { font-size: 14px; font-weight: 700; }
.dp-action-btn--download .dp-action-btn__sub   { font-size: 12px; opacity: .85; }
.dp-action-btn--locked {
  background: #9e9e9e !important;
  cursor: not-allowed;
  color: #fff !important;
}
.dp-action-btn--locked:hover { background: #9e9e9e !important; }

/* Per-button color themes — colors always visible (not just on hover) */

/* Save — gold/amber */
.dp-action-btn--save { background: #fffbea; border-color: #f5c518; color: #b8860b; }
.dp-action-btn--save:hover { background: #fff3c4; border-color: #e4b400; }
.dp-action-btn--save.dp-action-btn--active { background: #fff0a0; border-color: #f5c518; color: #92680a; font-weight: 700; }

/* Like — green light */
.dp-action-btn--like { background: #f0fdf4; border-color: #4ade80; color: #16a34a; }
.dp-action-btn--like:hover { background: #dcfce7; border-color: #22c55e; }
.dp-action-btn--like.dp-action-btn--active { background: #bbf7d0; border-color: #16a34a; color: #14532d; font-weight: 700; }

/* Dislike — red light */
.dp-action-btn--dislike { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }
.dp-action-btn--dislike:hover { background: #fee2e2; border-color: #f87171; }
.dp-action-btn--dislike.dp-action-btn--active { background: #fecaca; border-color: #ef4444; color: #991b1b; font-weight: 700; }

/* Share — blue light */
.dp-action-btn--share { background: #eff6ff; border-color: #93c5fd; color: #2563eb; }
.dp-action-btn--share:hover { background: #dbeafe; border-color: #60a5fa; }
.dp-action-btn--share.dp-action-btn--active { background: #bfdbfe; border-color: #3b82f6; color: #1d4ed8; font-weight: 700; }

/* Generic active override (fallback) */
.dp-action-btn--active {
  font-weight: 700;
}
.dp-action-btn__icon  { font-size: 18px; line-height: 1; }
.dp-action-btn__label { font-size: 11px; font-weight: 600; }
.dp-action-btn__sub   { font-size: 10px; opacity: .75; }

/* ── LEFT sidebar meta / info ────────────────────────────────────────────── */
.dp-doc-page__meta-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 11.5px;
  color: #666;
  margin-bottom: 8px;
}
.dp-meta-sep  { color: #ddd; }
.dp-meta-icon { width: 12px; height: 12px; vertical-align: middle; margin-right: 2px; flex-shrink: 0; }
.dp-meta-item { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.dp-meta-badge { font-size: 10px !important; padding: 1px 5px !important; vertical-align: middle; }

.dp-pages-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: #e6f9ef; color: #1a7a40; border: 1px solid #a3e4bc;
  border-radius: 4px; padding: 2px 7px; font-size: 11px; font-weight: 500;
  white-space: nowrap;
}
.dp-pages-badge strong { font-weight: 700; color: #157a38; }

.dp-doc-page__title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 12px;
  color: var(--dc-black);
}
.dp-doc-page__excerpt {
  font-size: 12px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 12px;
}

/* ── Document info box (right sidebar) ───────────────────────────────────── */
.dp-doc-page__info-box {
  font-size: 12.5px;
  line-height: 1.6;
  margin-bottom: 14px;
}
.dp-doc-page__info-box strong {
  font-size: 13px;
  font-weight: 700;
  display: block;
  margin-bottom: 8px;
  color: var(--dc-black);
}
.dp-doc-page__info-box p { margin: 4px 0; color: #555; }
.dp-doc-page__info-box a { color: var(--dc-blue); text-decoration: none; }
.dp-doc-page__info-box a:hover { text-decoration: underline; }
.dp-meta-size { color: #888; font-size: 11px; }

/* ── Right sidebar: "You Might Also Like" section header ────────────────── */
.dp-related__heading {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #555;
  margin: 0 0 12px;
  padding-top: 8px;
  border-top: 1px solid var(--dc-grey-bd);
}

.dp-related__list { display: flex; flex-direction: column; gap: 0; }
.dp-related__loading { font-size: 12px; color: #aaa; text-align: center; padding: 14px 0; }
.dp-related__empty  { font-size: 12px; color: #aaa; text-align: center; padding: 14px 0; }

/* ── Related items — match design: thumbnail + PDF badge + title + meta ──── */
.dp-related-item {
  display: flex;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  padding: 10px 4px;
  border-bottom: 1px solid #f0f0f0;
  transition: background .12s;
  align-items: flex-start;
}
.dp-related-item:last-child { border-bottom: none; }
.dp-related-item:hover { background: #fafafa; }

.dp-related-item__thumb-wrap { position: relative; flex-shrink: 0; }
.dp-related-item__thumb {
  width: 52px;
  height: 68px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  display: block;
}
.dp-related-item__thumb--ph {
  width: 52px; height: 68px;
  background: #f3f4f6; border-radius: 3px; border: 1px solid #e0e0e0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: #9ca3af;
}
.dp-related-item__badge {
  position: absolute; top: 3px; left: 3px;
}
.dp-related-item__badge .dp-badge {
  font-size: 8px; padding: 1px 3px; border-radius: 2px;
}

.dp-related-item__body { flex: 1; min-width: 0; }
.dp-related-item__title {
  font-size: 12px; font-weight: 600; margin: 2px 0 4px;
  line-height: 1.4; color: #222;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.dp-related-item__meta { font-size: 11px; color: #888; }
.dp-badge--sm { font-size: 9px; padding: 1px 4px; }

/* ── CENTER: document title bar above viewer ─────────────────────────────── */
.dc-viewer-title-bar {
  background: #fff;
  border-bottom: 1px solid var(--dc-grey-bd);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--dc-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── AD slot in center, below title bar ─────────────────────────────────── */
.dc-center-ad-slot {
  background: #fff;
  border-bottom: 1px solid var(--dc-grey-bd);
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 12px;
  color: #bbb;
}

/* ── Viewer toolbar ──────────────────────────────────────────────────────── */
#docucore-viewer {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 100vh;
}
.docucore-viewer__toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: #3d3d3d;
  color: #fff;
  flex-shrink: 0;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 10;
}
.dp-viewer-btn {
  background: rgba(255,255,255,.12);
  border: none; color: #fff;
  padding: 5px 10px; border-radius: 4px;
  cursor: pointer; font-size: 14px;
  transition: background .15s;
}
.dp-viewer-btn:hover:not(:disabled) { background: rgba(255,255,255,.22); }
.dp-viewer-btn:disabled { opacity: .35; cursor: not-allowed; }

.dp-page-info { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.dp-page-input {
  width: 48px; padding: 3px 6px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 4px; color: #fff; text-align: center; font-size: 13px;
}
.dp-page-input:focus { outline: none; background: rgba(255,255,255,.25); }
.dp-page-sep    { color: rgba(255,255,255,.6); }
.dp-toolbar-spacer { flex: 1; }
.dp-zoom-label  { font-size: 12px; min-width: 40px; text-align: center; }

.docucore-viewer__body {
  flex: 1; overflow: auto;
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 16px; background: #525659; min-height: 600px;
}
.docucore-viewer__status { color: #ccc; font-size: 14px; padding: 48px; text-align: center; }
#dp-canvas { display: block; box-shadow: 0 4px 32px rgba(0,0,0,.5); max-width: 100%; }

.docucore-viewer__docx-content {
  background: #fff; max-width: 800px; width: 100%;
  padding: 48px 56px; box-shadow: 0 2px 16px rgba(0,0,0,.3);
  font-size: 15px; line-height: 1.7; color: #111; border-radius: 2px;
}
.docucore-viewer__docx-content h1,h2,h3 { margin-top: 1.4em; }
.docucore-viewer__docx-content p { margin: .8em 0; }
.docucore-viewer__docx-content table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.docucore-viewer__docx-content td,th { border: 1px solid #ccc; padding: 6px 10px; }

.docucore-viewer__blocked {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 400px; padding: 32px; text-align: center; color: #ddd; gap: 16px;
}
.docucore-viewer__error { color: #e88; padding: 32px; text-align: center; }
.docucore-viewer__error-box {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 300px; padding: 32px;
  text-align: center; gap: 14px; color: #ccc;
}
.dp-error-icon { font-size: 40px; }
.dp-error-msg  { font-size: 14px; max-width: 480px; line-height: 1.6; color: #ddd; }

/* ── TABLE OF CONTENTS ───────────────────────────────────────────────────── */
.dp-toc-wrap {
  margin: 12px 0;
  border: 1px solid var(--dc-grey-bd);
  border-radius: 6px;
  overflow: hidden;
}
.dp-toc__toggle {
  display: flex; align-items: center; gap: 6px; padding: 9px 12px;
  font-size: 11px; font-weight: 700; color: #444; text-transform: uppercase;
  letter-spacing: .06em; cursor: pointer; background: #f8f9fa;
  list-style: none; user-select: none;
  border-bottom: 1px solid transparent;
}
details.dp-toc-wrap[open] .dp-toc__toggle { border-bottom-color: var(--dc-grey-bd); }
.dp-toc__toggle::-webkit-details-marker { display: none; }
.dp-toc-wrap summary::after { content: '▸'; margin-left: auto; transition: transform .2s; font-size: 10px; }
details[open] summary::after { transform: rotate(90deg); }
.dp-toc { max-height: 260px; overflow-y: auto; padding: 6px 0; }
.dp-toc__empty { padding: 8px 12px; font-size: 12px; color: #aaa; margin: 0; font-style: italic; }
.dp-toc__list  { list-style: none; margin: 0; padding: 0; }
.dp-toc__entry { margin: 0; }
.dp-toc__item  {
  display: block; padding: 5px 12px; font-size: 12px; color: #444;
  text-decoration: none; line-height: 1.4; transition: background .1s, color .1s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dp-toc__item:hover   { background: #f0f4f8; color: var(--dc-blue); }
.dp-toc__item--active { background: #eff6ff; color: var(--dc-blue); font-weight: 600; }
.dp-toc__item--depth-0 { padding-left: 12px; }
.dp-toc__item--depth-1 { padding-left: 22px; font-size: 11px; }
.dp-toc__item--depth-2 { padding-left: 32px; font-size: 11px; color: #6b7280; }

/* ── TAGS slot (bottom of left sidebar) ─────────────────────────────────── */
.dc-tags-slot {
  border: 1px solid var(--dc-grey-bd);
  border-radius: 6px;
  background: #fafafa;
  min-height: 100px;
  padding: 10px;
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
}
.dc-tag {
  display: inline-block;
  padding: 3px 10px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 999px;
  font-size: 12px;
  color: #555;
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.dc-tag:hover { border-color: #888; color: var(--dc-black); }

/* ── Back to Library ─────────────────────────────────────────────────────── */
.dp-doc-page__back {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--dc-blue); text-decoration: none;
  margin-top: 12px;
}
.dp-doc-page__back:hover { text-decoration: underline; }

/* ── Tier badges ─────────────────────────────────────────────────────────── */
.dp-tier-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.dp-tier-badge--free    { background: #e8f5e9; color: #2e7d32; }
.dp-tier-badge--pro     { background: #e3f2fd; color: #1565c0; }
.dp-tier-badge--premium { background: #fce4ec; color: #880e4f; }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.dp-spinner-ring {
  display: inline-block; width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: rgba(255,255,255,.7);
  border-radius: 50%; animation: dp-spin .7s linear infinite;
  vertical-align: middle; margin-right: 8px;
}
@keyframes dp-spin { to { transform: rotate(360deg); } }

/* ── Toast / Share panel ─────────────────────────────────────────────────── */
.dp-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: #1e293b; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 14px; font-weight: 500; z-index: 99999; pointer-events: none;
  opacity: 0; transition: opacity .3s, transform .3s; box-shadow: 0 4px 20px rgba(0,0,0,.3);
}
.dp-toast--visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.dp-toast--success { background: #166534; }
.dp-toast--info    { background: #1e3a5f; }
.dp-toast--error   { background: #991b1b; }

.dp-share-panel {
  position: fixed; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.16);
  min-width: 210px; z-index: 99999; overflow: hidden; padding: 6px 0;
  animation: dp-share-in .15s ease;
}
@keyframes dp-share-in { from { opacity:0; transform: translateY(-4px); } to { opacity:1; transform: translateY(0); } }
.dp-share-panel[hidden] { display: none; }
.dp-share-panel__item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px;
  border: none; background: none; cursor: pointer; font-size: 14px; color: #1f2937;
  text-align: left; transition: background .12s;
}
.dp-share-panel__item:hover { background: #f3f4f6; outline: none; }
.dp-share-panel__icon { display: flex; align-items: center; flex-shrink: 0; width: 22px; }
.dp-share-panel__label { flex: 1; }

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE HEADER — Title + horizontal action toolbar
   Hidden on desktop. First element on mobile.
   ═══════════════════════════════════════════════════════════════════════════ */
.dp-mobile-header { display: none; }     /* hidden desktop */
.dp-mobile-search { display: none; }     /* hidden desktop */
.dp-mobile-badges { display: none; }     /* hidden desktop */
.dp-mobile-info   { display: none; }     /* hidden desktop */

/* ═══════════════════════════════════════════════════════════════════════════
   NEXT / PREVIOUS NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════ */
.dp-doc-nav {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 16px; background: var(--dc-grey-bg);
  border-top: 1px solid var(--dc-grey-bd); flex-shrink: 0;
}
.dp-doc-nav__link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; background: #1a73e8; color: #fff;
  border: 2px solid #1a73e8; border-radius: 6px;
  font-size: 14px; font-weight: 600; text-decoration: none;
  transition: background .15s, transform .1s; cursor: pointer;
}
.dp-doc-nav__link:hover { background: #1558b0; border-color: #1558b0; color: #fff; }
.dp-doc-nav__link--off {
  background: transparent; border-color: transparent;
  visibility: hidden; pointer-events: none;
}
.dp-doc-nav__arrow { width: 18px; height: 18px; flex-shrink: 0; }
.dp-doc-nav__text  { font-size: 14px; font-weight: 600; }

/* ── RESPONSIVE ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .dp-doc-page { grid-template-columns: 200px 1fr 240px; }
}

@media (max-width: 900px) {
  /* Switch to single-column — mobile layout */
  .dp-doc-page {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  /* Reorder: Mobile Header → Center → Right → Left */
  .dp-mobile-header  { order: 1; display: block; }
  .dp-doc-page__center { order: 2; min-height: 60vh; }
  .dp-doc-page__right  { order: 3; min-height: auto; position: static; max-height: none; border-left: none; border-top: 1px solid var(--dc-grey-bd); }
  .dp-doc-page__left   { order: 4; display: none; /* hide desktop sidebar on mobile */ }

  /* Show mobile-only sections */
  .dp-mobile-badges { display: block; }
  .dp-mobile-info   { display: block; padding: 16px; background: #fff; }

  /* Hide desktop title bar (mobile header has its own) */
  .dc-viewer-title-bar { display: none; }

  .dp-action-grid { grid-template-columns: repeat(4, 1fr); }

  /* ── Mobile Header styles ─────────────────────────────────────────── */
  .dp-mobile-header {
    background: #fff;
    border-bottom: 1px solid var(--dc-grey-bd);
    padding: 10px 12px 8px;
  }
  .dp-mobile-header__title {
    font-size: 16px; font-weight: 700; color: #111;
    margin: 0 0 8px; line-height: 1.3;
    overflow: hidden; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  }

  /* ── Mobile Search Box ────────────────────────────────────────────── */
  .dp-mobile-search { margin-bottom: 8px; }
  .dp-mobile-search__form {
    display: flex; align-items: center; gap: 0;
    border: 1.5px solid #d1d5db; border-radius: 6px;
    background: #fff; overflow: hidden;
  }
  .dp-mobile-search__input {
    flex: 1; border: none; outline: none; padding: 8px 12px;
    font-size: 14px; background: transparent; color: #111;
    min-width: 0;
  }
  .dp-mobile-search__input::placeholder { color: #9ca3af; }
  .dp-mobile-search__btn {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; background: none; border: none;
    color: #6b7280; cursor: pointer; flex-shrink: 0;
  }
  .dp-mobile-search__btn svg { width: 18px; height: 18px; }

  /* ── Mobile Toolbar — horizontal colored buttons ──────────────────── */
  .dp-mobile-toolbar {
    display: flex; gap: 4px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: #fff; padding: 2px 0;
  }
  .dp-mobile-toolbar::-webkit-scrollbar { display: none; }

  .dp-mtb__btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 8px 6px; min-width: 56px;
    border: 1px solid transparent; border-radius: 6px; cursor: pointer;
    font-size: 9px; font-weight: 600; text-decoration: none; white-space: nowrap;
    transition: opacity .15s, transform .1s; flex-shrink: 0;
  }
  .dp-mtb__btn:active { transform: scale(0.95); }
  .dp-mtb__btn svg { width: 20px; height: 20px; flex-shrink: 0; }
  .dp-mtb__btn span { font-size: 9.5px; font-weight: 600; }

  /* ── Per-button colors matching the screenshot ──────────────────────── */

  /* Download — solid red */
  .dp-mtb__btn--dl {
    background: #dc2626; color: #fff; border-color: #dc2626;
    flex-direction: row; gap: 4px; padding: 8px 14px;
    border-radius: 4px; font-weight: 700;
  }
  .dp-mtb__btn--dl svg { width: 16px; height: 16px; }
  .dp-mtb__btn--dl span { font-size: 11px; color: #fff; }
  .dp-mtb__btn--dl:hover { opacity: .9; }
  .dp-mtb__btn--locked { background: #dc2626 !important; color: #fff !important; border-color: #dc2626 !important; }

  /* Save — light amber */
  .dp-mtb__btn--save {
    background: #fffbea; border-color: #fde68a; color: #b8860b;
  }
  .dp-mtb__btn--save svg { stroke: #b8860b; }

  /* Like — light green */
  .dp-mtb__btn--like {
    background: #f0fdf4; border-color: #86efac; color: #16a34a;
  }
  .dp-mtb__btn--like svg { stroke: #16a34a; }
  .dp-mtb__btn--like span { color: #16a34a; }

  /* Dislike — light red */
  .dp-mtb__btn--dislike {
    background: #fef2f2; border-color: #fca5a5; color: #dc2626;
  }
  .dp-mtb__btn--dislike svg { stroke: #dc2626; }
  .dp-mtb__btn--dislike span { color: #dc2626; }

  /* Share — light teal */
  .dp-mtb__btn--share {
    background: #f0fdfa; border-color: #99f6e4; color: #0d9488;
  }
  .dp-mtb__btn--share svg { stroke: #0d9488; }
  .dp-mtb__btn--share span { color: #0d9488; }

  /* Report — light orange */
  .dp-mtb__btn--report {
    background: #fff7ed; border-color: #fed7aa; color: #ea580c;
  }
  .dp-mtb__btn--report svg { stroke: #ea580c; }
  .dp-mtb__btn--report span { color: #ea580c; }

  /* Print — light grey */
  .dp-mtb__btn--print {
    background: #f3f4f6; border-color: #d1d5db; color: #4b5563;
  }
  .dp-mtb__btn--print svg { stroke: #4b5563; }
  .dp-mtb__btn--print span { color: #4b5563; }

  /* ── Mobile badges strip ──────────────────────────────────────────── */
  .dp-mobile-badges {
    background: #f8f9fa;
    border-bottom: 1px solid var(--dc-grey-bd);
    padding: 10px 12px;
  }
  .dp-mobile-badges .dp-doc-info-badges {
    display: flex; flex-wrap: wrap; gap: 6px;
    justify-content: center;
  }

  /* ── Mobile info sections (category, tags) ────────────────────────── */
  .dp-mobile-section {
    margin-top: 12px;
  }
  .dp-mobile-section strong {
    display: block; font-size: 13px; color: #333; margin-bottom: 6px;
  }
  .dp-mobile-section__chips {
    display: flex; flex-wrap: wrap; gap: 6px;
  }
  .dp-mobile-info .dp-doc-page__info-box {
    background: transparent; border: none; padding: 0; margin-bottom: 8px;
  }

  /* Nav on mobile */
  .dp-doc-nav { padding: 10px 12px; gap: 8px; }
  .dp-doc-nav__link { padding: 6px 14px; font-size: 13px; }
  .dp-doc-nav__arrow { width: 16px; height: 16px; }
}

@media (max-width: 600px) {
  .dp-mobile-header { padding: 8px 10px 6px; }
  .dp-mobile-header__title { font-size: 14px; margin-bottom: 6px; }
  .dp-mobile-search__input { padding: 7px 10px; font-size: 13px; }
  .dp-mtb__btn { padding: 6px 5px; min-width: 48px; }
  .dp-mtb__btn svg { width: 17px; height: 17px; }
  .dp-mtb__btn span { font-size: 8px; }
  .dp-mtb__btn--dl { padding: 6px 10px; }
  .dp-mtb__btn--dl span { font-size: 10px; }
  .docucore-viewer__docx-content { padding: 24px 16px; }
  .dp-doc-nav__link { padding: 6px 12px; font-size: 12px; }
}

/* RTL VIEWER SUPPORT */
[dir="rtl"] .dp-doc-page,
body.rtl .dp-doc-page {
  direction: rtl;
}
[dir="rtl"] .dp-doc-page__left,
body.rtl .dp-doc-page__left {
  border-right: none;
  border-left: 1px solid var(--dc-grey-bd);
}
[dir="rtl"] .dp-doc-page__right,
body.rtl .dp-doc-page__right {
  border-left: none;
  border-right: 1px solid var(--dc-grey-bd);
}
[dir="rtl"] .dp-doc-page__title,
[dir="rtl"] .dp-doc-page__info-box,
body.rtl .dp-doc-page__title,
body.rtl .dp-doc-page__info-box {
  font-family: 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  text-align: right;
}
[dir="rtl"] .dp-action-btn--download,
body.rtl .dp-action-btn--download { direction: rtl; }

[dir="rtl"] .dp-doc-page__back,
body.rtl .dp-doc-page__back { direction: rtl; }

[dir="rtl"] .dc-viewer-title-bar,
body.rtl .dc-viewer-title-bar {
  font-family: 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  text-align: right;
}

[dir="rtl"] .dp-related-item__thumb-wrap,
body.rtl .dp-related-item__thumb-wrap { direction: ltr; }
[dir="rtl"] .dp-related-item__title,
body.rtl .dp-related-item__title {
  font-family: 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  text-align: right;
}

/* ── DOCUMENT INFO BADGES (Pages / Type / Views / Size) ─────────────────── */
.dp-doc-info-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0;
}
.dp-info-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}
/* Pages — orange */
.dp-info-badge--pages {
  background: #ff8c00;
  color: #fff;
}
/* Type (PDF/DOCX) — green */
.dp-info-badge--type {
  background: #22c55e;
  color: #fff;
}
/* Views — amber/yellow */
.dp-info-badge--views {
  background: #eab308;
  color: #fff;
}
/* Size — blue */
.dp-info-badge--size {
  background: #3b82f6;
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════════════
   REPORT BUTTON — Orange, full-width, below action grid
   ═══════════════════════════════════════════════════════════════════════════ */

.dp-action-btn--report {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
  padding: 9px 12px;
  background: #f97316;          /* orange-500 */
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  text-align: center;
}
.dp-action-btn--report:hover { background: #ea6c00; }
.dp-action-btn--report:active { transform: scale(0.97); }
.dp-action-btn--report .dp-action-btn__icon { color: #fff; flex-shrink: 0; }
.dp-action-btn--report .dp-action-btn__label { color: #fff; font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════════════
   REPORT MODAL
   ═══════════════════════════════════════════════════════════════════════════ */

.dp-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dp-modal[hidden] { display: none !important; }

.dp-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.dp-modal__panel {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.22);
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: dp-modal-in 0.2s ease;
}

@keyframes dp-modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.dp-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.dp-modal__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #111;
  line-height: 1.3;
}
.dp-modal__close {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color 0.15s;
}
.dp-modal__close:hover { color: #111; }

.dp-modal__body {
  padding: 0 20px;
  overflow-y: auto;
  flex: 1;
}

.dp-modal__footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.dp-report-msg {
  flex: 1;
  font-size: 12px;
  min-width: 0;
  word-break: break-word;
}
.dp-report-msg--success { color: #16a34a; font-weight: 600; }
.dp-report-msg--error   { color: #dc2626; }

.dp-modal__btn {
  padding: 9px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
  white-space: nowrap;
}
.dp-modal__btn--cancel {
  background: #fff;
  border: 1.5px solid #d1d5db;
  color: #374151;
}
.dp-modal__btn--cancel:hover { background: #f9fafb; }

.dp-modal__btn--submit {
  background: #111;
  color: #fff;
}
.dp-modal__btn--submit:hover:not(:disabled) { background: #333; }
.dp-modal__btn--submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* Report sections */
.dp-report-section {
  padding: 16px 0 12px;
}
.dp-report-section__title {
  font-size: 14px;
  font-weight: 700;
  color: #111;
  margin: 0 0 8px;
}
.dp-report-section__desc {
  font-size: 13px;
  color: #374151;
  line-height: 1.6;
  margin: 0;
}
.dp-report-link {
  color: #111;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.dp-report-link:hover { color: #f97316; }
.dp-report-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 0;
}

/* Report radio options */
.dp-report-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.dp-report-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 4px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s;
}
.dp-report-option:hover { background: #f9fafb; }
.dp-report-radio {
  width: 17px;
  height: 17px;
  accent-color: #111;
  cursor: pointer;
  flex-shrink: 0;
}
.dp-report-option__label {
  flex: 1;
  font-size: 13.5px;
  color: #111;
  font-weight: 500;
}
.dp-report-info-btn {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 14px;
  cursor: help;
  padding: 2px 4px;
  border-radius: 3px;
  transition: color 0.1s;
  flex-shrink: 0;
  line-height: 1;
}
.dp-report-info-btn:hover { color: #374151; }

.dp-report-note {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  box-sizing: border-box;
  transition: border-color 0.15s;
  color: #111;
}
.dp-report-note:focus { outline: none; border-color: #6b7280; }

.dp-report-disclaimer {
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
  margin: 10px 0 4px;
  line-height: 1.5;
}

/* Body scroll lock when modal open */
body.dp-modal-open { overflow: hidden; }

/* RTL modal */
[dir="rtl"] .dp-modal__panel,
body.rtl .dp-modal__panel {
  font-family: 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  text-align: right;
}
[dir="rtl"] .dp-modal__header,
body.rtl .dp-modal__header { flex-direction: row-reverse; }
[dir="rtl"] .dp-modal__footer,
body.rtl .dp-modal__footer { flex-direction: row-reverse; }
[dir="rtl"] .dp-report-option,
body.rtl .dp-report-option { flex-direction: row-reverse; }
[dir="rtl"] .dp-action-btn--report,
body.rtl .dp-action-btn--report { direction: rtl; }

/* Mobile */
@media (max-width: 480px) {
  .dp-modal__panel { max-width: 100%; border-radius: 12px 12px 0 0; max-height: 95vh; }
  .dp-modal { align-items: flex-end; }
}


/* ══════════════════════════════════════════════════════════════════════════
   DocuCore v2.2 — Download red state, Print button, Ad slots, Related items,
                   Category page styles, Library card improvements
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Requirement 2: RED download button — not logged in OR limit reached ── */
.dp-action-btn--download-red,
a.dp-action-btn--download-red {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
    color: #fff !important;
    cursor: pointer;
}
.dp-action-btn--download-red:hover,
a.dp-action-btn--download-red:hover {
    background: #b91c1c !important;
    border-color: #b91c1c !important;
    color: #fff !important;
}
.dp-action-btn--download-red:disabled {
    background: #dc2626 !important;
    opacity: .75;
    cursor: not-allowed;
}

/* ── v2.3: Print button — grey card matching other action buttons ────────── */
.dp-action-btn--print {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    /* flex-direction: column (inherits from .dp-action-btn) */
}
.dp-action-btn--print:hover {
    background: #e5e7eb;
    color: #111827;
    border-color: #9ca3af;
}
.dp-action-btn--print:active { background: #d1d5db; transform: scale(0.97); }
.dp-action-btn--print:focus-visible {
    outline: 2px solid #6b7280;
    outline-offset: 2px;
}
.dp-action-btn--print .dp-action-btn__icon { font-size: 14px; line-height: 1; }
.dp-action-btn--print .dp-action-btn__label { font-size: 11px; font-weight: 600; }

/* ── Ad slot placeholders ───────────────────────────────────────────────── */
.dc-ad-placeholder {
    display: block;
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    font-style: italic;
    padding: 4px 0;
    user-select: none;
    pointer-events: none;
}
.dc-ad-slot--left {
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    background: #fafafa;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    overflow: hidden;
    text-align: center;
    padding: 8px;
}
.dc-center-ad-slot,
.dc-bottom-ad-slot {
    background: #fafafa;
    border-bottom: 1px solid #e5e7eb;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    text-align: center;
    overflow: hidden;
}
.dc-bottom-ad-slot {
    border-top: 1px solid #e5e7eb;
    border-bottom: none;
    margin-top: auto;
}
.dc-ad-slot--right {
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    background: #fafafa;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    overflow: hidden;
    text-align: center;
    padding: 8px;
}

/* ── Requirement 5: "You Might Also Like" — redesigned per screenshot ───── */
/* Layout: [save-btn] [text: title + meta] [thumbnail-right] */

.dp-related__list  { display: flex; flex-direction: column; }
.dp-related__loading { font-size: 12px; color: #aaa; text-align: center; padding: 14px 0; }
.dp-related__empty   { font-size: 12px; color: #aaa; text-align: center; padding: 14px 0; }

/* Outer wrapper — row layout per screenshot */
.dp-related-item__wrap {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}
.dp-related-item__wrap:last-child { border-bottom: none; }

/* Save / bookmark button — left side, always visible (not hidden) */
.dp-related-item__save {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    min-width: 26px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #9ca3af;
    transition: color .15s, border-color .15s, background .15s;
    padding: 0;
    margin-top: 2px;
}
.dp-related-item__save:hover {
    color: #374151;
    border-color: #9ca3af;
    background: #f9fafb;
}
.dp-related-item__save.is-saved {
    color: #111827;
    border-color: #374151;
    background: #f3f4f6;
}
.dp-related-item__save:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}
.dp-related-item__save svg {
    width: 14px;
    height: 14px;
}

/* The <a> link — takes remaining space, flex row */
.dp-related-item {
    display: flex;
    flex: 1;
    align-items: flex-start;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
    /* no padding-right — thumb is inside the link on the right */
}
.dp-related-item:hover { color: inherit; }

/* Text body — takes all remaining space between save-btn and thumb */
.dp-related-item__body {
    flex: 1;
    min-width: 0;
}
.dp-related-item__title {
    font-size: 12px;
    font-weight: 600;
    margin: 0 0 5px;
    line-height: 1.45;
    color: #1a1a1a;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
.dp-related-item__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    font-size: 11px;
    color: #6b7280;
}
.dp-related-item__rating {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #6b7280;
}
.dp-related-item__rating svg {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
}
.dp-related-item__rating--empty { font-style: italic; }
.dp-related-item__sep { color: #d1d5db; }
.dp-related-item__pages { color: #6b7280; }

/* Thumbnail — right side */
.dp-related-item__thumb-wrap {
    flex-shrink: 0;
    position: relative;
    width: 52px;
    height: 68px;
}
.dp-related-item__thumb {
    width: 52px;
    height: 68px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    display: block;
}
.dp-related-item__thumb--ph {
    width: 52px;
    height: 68px;
    background: #f3f4f6;
    border-radius: 3px;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: #9ca3af;
    letter-spacing: .5px;
}
.dp-related-item__badge {
    position: absolute;
    top: 3px;
    left: 3px;
}

/* ── Info-box category link ─────────────────────────────────────────────── */
.dp-info-cat-link {
    display: inline-block;
    color: #1a73e8;
    font-size: 12px;
    text-decoration: none;
    margin-right: 6px;
}
.dp-info-cat-link:hover { text-decoration: underline; }

/* ── Download counter in info box ──────────────────────────────────────── */
.dp-dl-counter {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RTL — Mobile header, toolbar, navigation
   ═══════════════════════════════════════════════════════════════════════════ */
[dir="rtl"] .dp-mobile-header__title,
body.rtl .dp-mobile-header__title {
  text-align: right;
  font-family: 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
}
[dir="rtl"] .dp-mobile-toolbar,
body.rtl .dp-mobile-toolbar { direction: rtl; }
[dir="rtl"] .dp-mobile-search__input,
body.rtl .dp-mobile-search__input { text-align: right; }
[dir="rtl"] .dp-mobile-search__form,
body.rtl .dp-mobile-search__form { flex-direction: row-reverse; }
[dir="rtl"] .dp-doc-nav,
body.rtl .dp-doc-nav { flex-direction: row-reverse; }
[dir="rtl"] .dp-doc-nav__link--prev,
body.rtl .dp-doc-nav__link--prev { flex-direction: row-reverse; }
[dir="rtl"] .dp-doc-nav__link--next,
body.rtl .dp-doc-nav__link--next { flex-direction: row-reverse; }
[dir="rtl"] .dp-mobile-info,
body.rtl .dp-mobile-info {
  direction: rtl; text-align: right;
  font-family: 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
}
[dir="rtl"] .dp-mobile-section strong,
body.rtl .dp-mobile-section strong { text-align: right; }

/* ═══════════════════════════════════════════════════════════════════════════
   THEME MOBILE MENU COMPATIBILITY
   DocuCore sets z-index: 0 on .dp-doc-page so that theme fixed/sticky
   headers and mobile nav drawers naturally appear above the document viewer.
   If your theme's mobile menu is still hidden, add this to your theme CSS:
     .your-mobile-nav-class { z-index: 1000; }
   ═══════════════════════════════════════════════════════════════════════════ */
