/* ============================================================
   AJSMR Professional Academic PDF Viewer Modal Styles
   ============================================================ */

.ajsmr-pdf-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 2vh 2vw;
  box-sizing: border-box;
}

.ajsmr-pdf-overlay.active {
  opacity: 1;
  visibility: visible;
}

.ajsmr-pdf-modal {
  width: 92vw;
  max-width: 1500px;
  height: 92vh;
  max-height: 95vh;
  background: #1e293b;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transform: scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: #f8fafc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.ajsmr-pdf-overlay.active .ajsmr-pdf-modal {
  transform: scale(1);
}

/* Header */
.ajsmr-pdf-header {
  height: 56px;
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  user-select: none;
  flex-shrink: 0;
}

.ajsmr-pdf-header-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  margin-right: 16px;
}

.ajsmr-pdf-badge {
  background: #0284c7;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.3);
}

.ajsmr-pdf-doc-title {
  font-size: 14px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ajsmr-pdf-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ajsmr-pdf-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  line-height: 1;
  text-decoration: none;
}

.ajsmr-pdf-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

.ajsmr-pdf-btn-primary {
  background: #0284c7;
  color: #ffffff;
  border-color: #0369a1;
}

.ajsmr-pdf-btn-primary:hover {
  background: #0369a1;
}

.ajsmr-pdf-btn-close {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
  padding: 6px 10px;
}

.ajsmr-pdf-btn-close:hover {
  background: rgba(239, 68, 68, 0.85);
  color: #ffffff;
  border-color: #ef4444;
}

/* Body / Document Viewport */
.ajsmr-pdf-body {
  flex: 1;
  background: #334155;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  box-sizing: border-box;
  scroll-behavior: smooth;
}

/* Pages Container */
.ajsmr-pdf-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.ajsmr-pdf-page-card {
  position: relative;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.ajsmr-pdf-page-card canvas {
  display: block;
  margin: 0 auto;
}

.ajsmr-pdf-page-badge {
  position: absolute;
  bottom: 8px;
  right: 12px;
  background: rgba(15, 23, 42, 0.7);
  color: #f8fafc;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

/* Loader */
.ajsmr-pdf-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #1e293b;
  z-index: 10;
  gap: 16px;
}

.ajsmr-pdf-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(2, 132, 199, 0.2);
  border-top-color: #0284c7;
  border-radius: 50%;
  animation: ajsmr-spin 0.8s linear infinite;
}

@keyframes ajsmr-spin {
  to { transform: rotate(360deg); }
}

.ajsmr-pdf-loader-text {
  font-size: 15px;
  color: #94a3b8;
  font-weight: 500;
}

/* Error State */
.ajsmr-pdf-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #1e293b;
  z-index: 10;
  padding: 30px;
  text-align: center;
  gap: 14px;
}

.ajsmr-pdf-error-icon {
  font-size: 40px;
  color: #f87171;
}

.ajsmr-pdf-error-title {
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
}

.ajsmr-pdf-error-desc {
  font-size: 14px;
  color: #94a3b8;
  max-width: 420px;
  line-height: 1.5;
}

.ajsmr-pdf-error-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

/* Toolbar / Footer */
.ajsmr-pdf-toolbar {
  height: 52px;
  background: #0f172a;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  user-select: none;
  flex-shrink: 0;
  gap: 12px;
}

.ajsmr-pdf-toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ajsmr-pdf-page-indicator {
  font-size: 13px;
  color: #cbd5e1;
  font-weight: 500;
  min-width: 90px;
  text-align: center;
}

.ajsmr-pdf-zoom-label {
  font-size: 13px;
  color: #cbd5e1;
  font-weight: 500;
  min-width: 50px;
  text-align: center;
}

/* Fullscreen Mode */
.ajsmr-pdf-modal:fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
}

/* Responsive Layout */
@media (max-width: 768px) {
  .ajsmr-pdf-overlay {
    padding: 0;
  }
  .ajsmr-pdf-modal {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
  .ajsmr-pdf-header {
    padding: 0 12px;
    height: 50px;
  }
  .ajsmr-pdf-doc-title {
    font-size: 13px;
  }
  .ajsmr-pdf-toolbar {
    height: auto;
    padding: 8px 12px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .ajsmr-pdf-body {
    padding: 12px;
  }
}
