/* ============================================================
   pdf-modal.css — Full Page Fit Viewer
   ============================================================ */

#pdf-modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.88);
  z-index: 999999;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}
#pdf-modal-overlay.active {
  display: flex !important;
}

/* Modal box */
#pdf-modal-box {
  background: #ffffff;
  width: 100%;
  max-width: 960px;
  height: 92vh;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  animation: pdf-fadein 0.22s ease;
  user-select: none;
  -webkit-user-select: none;
}

@keyframes pdf-fadein {
  from { opacity: 0; transform: scale(0.97) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Header */
#pdf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #1a1a2e;
  flex-shrink: 0;
}

#pdf-modal-title {
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  font-family: Arial, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 75%;
}

#pdf-modal-close {
  background: #e74c3c;
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-family: Arial, sans-serif;
  font-weight: 600;
  transition: background 0.15s;
  flex-shrink: 0;
}
#pdf-modal-close:hover { background: #c0392b; }

/* Toolbar */
#pdf-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 16px;
  background: #2c2c3e;
  flex-shrink: 0;
  flex-wrap: wrap;
}

#pdf-modal-toolbar button {
  background: #3a3a5c;
  color: #ffffff;
  border: none;
  padding: 5px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: Arial, sans-serif;
  transition: background 0.15s;
  white-space: nowrap;
}
#pdf-modal-toolbar button:hover  { background: #5555aa; }
#pdf-modal-toolbar button:active { background: #3333aa; }

#pdf-page-info {
  color: #cccccc;
  font-size: 13px;
  font-family: Arial, sans-serif;
  white-space: nowrap;
  min-width: 90px;
  text-align: center;
}

/* Body — scrollable only when zoomed in */
#pdf-modal-body {
  flex: 1;
  overflow: auto;
  background: #525659;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  box-sizing: border-box;
}

/* Loading */
#pdf-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #ffffff;
  font-family: Arial, sans-serif;
  font-size: 14px;
  min-height: 300px;
  width: 100%;
  text-align: center;
}
#pdf-loading p { margin: 0; }

.pdf-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: #3498db;
  border-radius: 50%;
  animation: pdf-spin 0.8s linear infinite;
}
@keyframes pdf-spin { to { transform: rotate(360deg); } }

/* Canvas — auto sized by JS */
#pdf-canvas {
  display: block;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  background: #fff;
  /* No fixed width — JS controls canvas size */
}

/* Mobile */
@media (max-width: 600px) {
  #pdf-modal-overlay { padding: 0; }
  #pdf-modal-box { height: 100vh; border-radius: 0; max-width: 100%; }
  #pdf-modal-toolbar { gap: 5px; padding: 5px 8px; }
  #pdf-modal-toolbar button { font-size: 11px; padding: 4px 8px; }
}
