/* AID PDF Viewer Styling */
.aid-pdf-wrapper {
  position: relative;
  width: 100%;
  max-width: 1050px;
  margin: 35px auto 20px auto;
  background: #1e293b;
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(12, 113, 195, 0.12), 0 4px 16px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.aid-pdf-wrapper * {
  box-sizing: border-box;
}

/* Fullscreen Mode */
.aid-pdf-wrapper.aid-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  z-index: 9999999 !important;
}

/* Toolbar */
.aid-pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 16px;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
  z-index: 10;
}

.aid-toolbar-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.aid-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  line-height: 1;
  min-height: 32px;
}

.aid-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

.aid-btn:active {
  transform: translateY(1px);
}

.aid-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.aid-btn-primary {
  background: #0C71C3;
  border-color: #0C71C3;
}
.aid-btn-primary:hover {
  background: #09599b;
  border-color: #09599b;
}

/* Page Indicator */
.aid-page-indicator {
  font-size: 13px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.aid-page-input {
  width: 44px;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #fff;
  padding: 4px;
  font-size: 13px;
  font-weight: 600;
}
.aid-page-input:focus {
  outline: none;
  border-color: #0C71C3;
  background: rgba(255, 255, 255, 0.15);
}

/* Zoom display */
.aid-zoom-label {
  font-size: 12px;
  color: #94a3b8;
  min-width: 42px;
  text-align: center;
}

/* Viewer Scrollport */
.aid-pdf-viewport {
  position: relative;
  width: 100%;
  height: 82vh;
  min-height: 540px;
  max-height: 920px;
  overflow-y: auto !important;
  overflow-x: auto !important;
  background: #334155;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.aid-pdf-wrapper.aid-fullscreen .aid-pdf-viewport {
  height: calc(100vh - 54px) !important;
  max-height: none !important;
}

/* Single Page Container */
.aid-page-container {
  position: relative;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0 !important;
  margin: 0 auto;
}

.aid-page-container canvas {
  display: block;
}

/* Page Skeleton / Loader */
.aid-page-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
}

.aid-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(12, 113, 195, 0.2);
  border-top-color: #0C71C3;
  border-radius: 50%;
  animation: aid-spin 0.8s linear infinite;
  margin-bottom: 8px;
}

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

/* Global loading overlay */
.aid-global-loader {
  position: absolute;
  top: 54px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #f1f5f9;
  z-index: 20;
  backdrop-filter: blur(4px);
  gap: 12px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .aid-pdf-wrapper {
    margin: 20px auto;
    border-radius: 10px;
  }
  .aid-pdf-toolbar {
    padding: 8px 10px;
    gap: 8px;
  }
  .aid-btn {
    padding: 5px 8px;
    font-size: 12px;
  }
  .aid-pdf-viewport {
    height: 75vh;
    min-height: 440px;
    padding: 14px 6px;
    gap: 16px;
  }
  .aid-hide-mobile {
    display: none !important;
  }
}
