/**
 * PDF Viewer Widget — Styles
 * Professional PDF viewer with smooth interactions
 */

/* =====================================================================
   MAIN CONTAINER
===================================================================== */
.pea-pdf-viewer-wrap {
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.pea-pdf-viewer-wrap * {
  box-sizing: border-box;
}

/* =====================================================================
   NO FILE / PLACEHOLDER STATE
===================================================================== */
.pea-pdf-no-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
}

.pea-pdf-no-file-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.8;
}

.pea-pdf-no-file .pea-pdf-state-msg {
  color: #555;
  font-size: 16px;
  max-width: 400px;
}

/* =====================================================================
   TOOLBAR — Overall
===================================================================== */
.pea-pdf-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  width: 100%;
  padding: 10px 16px;
  background-color: #1e2327;
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
}

.pea-pdf-toolbar-left,
.pea-pdf-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pea-pdf-toolbar-right {
  margin-left: auto;
}

/* Button styles */
.pea-pdf-toolbar button,
.pea-pdf-toolbar a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background-color: transparent;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 200ms ease;
  text-decoration: none;
}

.pea-pdf-toolbar button:hover,
.pea-pdf-toolbar a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.pea-pdf-toolbar button:active {
  transform: translateY(0);
}

.pea-pdf-toolbar svg {
  display: block;
}

/* =====================================================================
   NAVIGATION ARROWS (Prev/Next)
===================================================================== */
.pea-pdf-btn-prev,
.pea-pdf-btn-next {
  font-size: 22px;
  min-width: 40px;
  height: 40px;
  font-weight: bold;
  line-height: 1;
}

.pea-pdf-btn-prev:disabled,
.pea-pdf-btn-next:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pea-pdf-btn-prev:disabled:hover,
.pea-pdf-btn-next:disabled:hover {
  background-color: transparent;
}

/* =====================================================================
   PAGE NUMBER INPUT GROUP
===================================================================== */
.pea-pdf-page-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  height: 36px;
}

.pea-pdf-page-input {
  width: 48px;
  height: 28px;
  padding: 4px 6px;
  border: none;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  transition: all 200ms ease;
}

.pea-pdf-page-input:focus {
  outline: none;
  background-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.3);
}

.pea-pdf-page-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

/* Spinner for number input */
.pea-pdf-page-input::-webkit-outer-spin-button,
.pea-pdf-page-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pea-pdf-page-input[type="number"] {
  -ms-progress-appearance: textfield;
  -webkit-appearance: textfield;
  appearance: textfield;
}

.pea-pdf-page-total {
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  white-space: nowrap;
}

/* =====================================================================
   ZOOM CONTROLS
===================================================================== */
.pea-pdf-btn-zoom-out,
.pea-pdf-btn-zoom-in {
  min-width: 32px;
  height: 32px;
  padding: 6px 8px;
}

.pea-pdf-zoom-level {
  min-width: 50px;
  text-align: center;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}

/* =====================================================================
   CANVAS AREA — PDF Display
===================================================================== */
.pea-pdf-canvas-area {
  position: relative;
  width: 100%;
  /* height: 700px; */
  background-color: #f5f5f5;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.pea-pdf-canvas-area::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.pea-pdf-canvas-area::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.pea-pdf-canvas-area::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 5px;
}

.pea-pdf-canvas-area::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Canvas container */
.pea-pdf-canvas-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: 100%;
}

.pea-pdf-canvas {
  display: block;
  margin: 10px auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  min-width: 100%;
  height: auto;
  border-radius: 2px;
}

/* =====================================================================
   LOADING STATE
===================================================================== */
.pea-pdf-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: #555;
}

.pea-pdf-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(88, 101, 242, 0.2);
  border-top-color: #5865f2;
  border-radius: 50%;
  animation: pea-spin 0.8s linear infinite;
}

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

/* =====================================================================
   ERROR STATE
===================================================================== */
.pea-pdf-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #e74c3c;
  text-align: center;
}

.pea-pdf-error-icon {
  font-size: 48px;
  opacity: 0.9;
}

.pea-pdf-error-text {
  max-width: 400px;
  font-size: 16px;
}

/* =====================================================================
   STATE MESSAGE (generic)
===================================================================== */
.pea-pdf-state-msg {
  text-align: center;
  font-size: 14px;
}

/* =====================================================================
   FAQ SECTION
===================================================================== */
.pea-pdf-faq-section {
  width: 100%;
  padding: 30px 0;
  margin-top: 30px;
}

.pea-pdf-faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 900px;
  margin: 0 auto;
}

.pea-pdf-faq-item {
  padding: 18px 22px;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: all 250ms ease;
  cursor: pointer;
}

.pea-pdf-faq-item:hover {
  background-color: #eef2ff;
  border-color: #5865f2;
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.1);
}

.pea-pdf-faq-q {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1a1a2e;
  transition: color 250ms ease;
}

.pea-pdf-faq-item:hover .pea-pdf-faq-q {
  color: #5865f2;
}

.pea-pdf-faq-a {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #555;
}

/* =====================================================================
   FULLSCREEN MODE
===================================================================== */
.pea-pdf-viewer-wrap.pea-pdf-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  min-width: 100vw;
  min-height: 100vh;
  z-index: 9999;
  border-radius: 0;
}

.pea-pdf-viewer-wrap.pea-pdf-fullscreen .pea-pdf-canvas-area {
  /* height: calc(100vh - 50px); */
  height: 100vh;
}

/* Prevent scrolling when in fullscreen */
body.pea-pdf-fullscreen-active {
  overflow: hidden;
}

/* =====================================================================
   RESPONSIVE DESIGN
===================================================================== */
@media (max-width: 768px) {
  .pea-pdf-toolbar {
    padding: 12px;
    gap: 8px;
  }

  .pea-pdf-toolbar-left,
  .pea-pdf-toolbar-right {
    gap: 8px;
  }

  .pea-pdf-toolbar-right {
    margin-left: 0;
    order: 3;
  }

  .pea-pdf-toolbar button,
  .pea-pdf-toolbar a {
    min-width: 32px;
    height: 32px;
    padding: 4px 8px;
    font-size: 12px;
  }

  .pea-pdf-btn-prev,
  .pea-pdf-btn-next {
    font-size: 18px;
    min-width: 36px;
    height: 36px;
  }

  .pea-pdf-page-group {
    height: 32px;
    padding: 0 6px;
  }

  .pea-pdf-page-input {
    width: 40px;
    height: 24px;
    font-size: 12px;
  }

  .pea-pdf-zoom-level {
    font-size: 12px;
    min-width: 45px;
  }

  .pea-pdf-canvas-area {
    height: 500px;
  }

  .pea-pdf-viewer-wrap.fullscreen .pea-pdf-canvas-area {
    height: calc(100vh - 45px);
  }

  .pea-pdf-toolbar svg {
    width: 14px;
    height: 14px;
  }
}

@media (max-width: 480px) {
  .pea-pdf-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .pea-pdf-toolbar-left {
    width: 100%;
  }
  .pea-pdf-toolbar-right {
    width: 100%;
  }

  .pea-pdf-zoom-level {
    display: none;
  }

  .pea-pdf-toolbar button,
  .pea-pdf-toolbar a {
    flex: 1;
    min-width: auto;
  }

  .pea-pdf-zoom-level {
    text-align: center;
    width: 100%;
  }

  .pea-pdf-canvas-area {
    height: 400px;
  }

  .pea-pdf-faq-list {
    padding: 0 10px;
  }

  .pea-pdf-faq-item {
    padding: 14px 16px;
  }

  .pea-pdf-faq-q {
    font-size: 14px;
  }

  .pea-pdf-faq-a {
    font-size: 13px;
  }
}

/* =====================================================================
   PRINT STYLES
===================================================================== */
@media print {
  .pea-pdf-toolbar,
  .pea-pdf-faq-section {
    display: none;
  }

  .pea-pdf-viewer-wrap {
    box-shadow: none;
    border: none;
  }

  .pea-pdf-canvas {
    box-shadow: none;
    page-break-after: always;
  }
}

/* =====================================================================
   TRANSITIONS & ANIMATIONS
===================================================================== */
.pea-pdf-toolbar button,
.pea-pdf-toolbar a {
  will-change: transform, background-color;
}

.pea-pdf-canvas {
  will-change: transform;
}

/* Smooth scrolling for canvas area */
.pea-pdf-canvas-area {
  scroll-behavior: smooth;
}

/* =====================================================================
   ACCESSIBILITY
===================================================================== */
.pea-pdf-toolbar button:focus,
.pea-pdf-page-input:focus,
.pea-pdf-toolbar a:focus {
  outline: 2px solid #5865f2;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: more) {
  .pea-pdf-toolbar {
    border: 2px solid #000;
  }

  .pea-pdf-toolbar button:hover {
    background-color: rgba(255, 255, 255, 0.2);
  }

  .pea-pdf-faq-item {
    border: 2px solid #000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .pea-pdf-spinner,
  .pea-pdf-toolbar button,
  .pea-pdf-toolbar a,
  .pea-pdf-faq-item,
  .pea-pdf-canvas {
    animation: none !important;
    transition: none !important;
  }
}
