/* === PDF Viewer Pro === */
:root {
  --pvp-primary: #2563eb;
  --pvp-primary-hover: #1d4ed8;
  --pvp-success: #16a34a;
  --pvp-danger: #dc2626;
  --pvp-bg: rgba(0,0,0,0.82);
  --pvp-radius: 10px;
  --pvp-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

/* ===== الأزرار ===== */
.pvp-wrapper {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  direction: rtl;
}

.pvp-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  direction: rtl;
  font-family: inherit;
}

.pvp-view-btn {
  background: var(--pvp-primary);
  color: #fff;
}
.pvp-view-btn:hover {
  background: var(--pvp-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(37,99,235,0.4);
}

.pvp-download-btn {
  background: #f1f5f9;
  color: #1e293b;
  border: 1.5px solid #e2e8f0;
}
.pvp-download-btn:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.pvp-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* ===== Overlay ===== */
.pvp-overlay {
  position: fixed;
  inset: 0;
  background: var(--pvp-bg);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pvpFadeIn 0.25s ease;
  direction: rtl;
  padding: 16px;
}

@keyframes pvpFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ===== Modal Base ===== */
.pvp-modal {
  background: #fff;
  border-radius: var(--pvp-radius);
  box-shadow: var(--pvp-shadow);
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: pvpSlideUp 0.3s ease;
  overflow: hidden;
  direction: rtl;
}

.pvp-modal-wait  { max-width: 420px; }
.pvp-modal-view  { max-width: 900px; }

@keyframes pvpSlideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ===== Modal Header ===== */
.pvp-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #e5e7eb;
  gap: 12px;
}

.pvp-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.pvp-close-btn {
  background: #f3f4f6;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.pvp-close-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* ===== Modal Body ===== */
.pvp-modal-body {
  padding: 28px 22px;
  overflow-y: auto;
}

/* ===== Wait Modal ===== */
.pvp-wait-content {
  text-align: center;
}

.pvp-countdown-ring {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 20px;
}

.pvp-countdown-ring svg {
  transform: rotate(-90deg);
}

.pvp-countdown-ring circle {
  fill: none;
  stroke-width: 6;
}

.pvp-ring-bg {
  stroke: #e5e7eb;
}

.pvp-ring-progress {
  stroke: var(--pvp-primary);
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}

.pvp-countdown-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: var(--pvp-primary);
}

.pvp-wait-text {
  font-size: 15px;
  color: #6b7280;
  margin-bottom: 8px;
}

.pvp-wait-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
}

.pvp-wait-action-btn {
  margin-top: 20px;
  padding: 12px 32px;
  background: var(--pvp-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: none;
}
.pvp-wait-action-btn:hover {
  background: var(--pvp-primary-hover);
}
.pvp-wait-action-btn.visible {
  display: inline-block;
  animation: pvpFadeIn 0.3s ease;
}

.pvp-wait-progress-bar {
  width: 100%;
  height: 6px;
  background: #e5e7eb;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 16px;
}
.pvp-wait-progress-fill {
  height: 100%;
  background: var(--pvp-primary);
  border-radius: 99px;
  width: 0%;
  transition: width 1s linear;
}

/* ===== View Modal ===== */
.pvp-pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}

.pvp-page-info {
  font-size: 14px;
  color: #4b5563;
  font-weight: 600;
}

.pvp-page-btn {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: #374151;
}
.pvp-page-btn:hover:not(:disabled) {
  background: var(--pvp-primary);
  color: #fff;
  border-color: var(--pvp-primary);
}
.pvp-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pvp-pdf-canvas-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #525659;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-height: 300px;
}

#pvp-pdf-canvas {
  max-width: 100%;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  border-radius: 2px;
}

.pvp-loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px;
  color: #9ca3af;
}

.pvp-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--pvp-primary);
  border-radius: 50%;
  animation: pvpSpin 0.8s linear infinite;
}

@keyframes pvpSpin {
  to { transform: rotate(360deg); }
}

/* ===== Error ===== */
.pvp-error-msg {
  text-align: center;
  padding: 24px;
  color: var(--pvp-danger);
  font-weight: 600;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .pvp-modal-view { max-width: 100%; }
  .pvp-modal-body { padding: 16px; }
}
