﻿.pm-pdf-book-launcher {
  margin: 18px 0;
}

.pm-pdf-open-btn {
  border: 0;
  background: var(--pm-plugin-accent, #e66a11);
  color: #fff;
  font-weight: 700;
  padding: 11px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-family: inherit;
}

.pm-pdf-open-btn:hover {
  background: var(--pm-plugin-accent-hover, #cf5d0d);
}

.pm-pdf-book-modal {
  --pm-modal-gap: 8px;
  --pm-modal-surface: #ffffff;
  --pm-plugin-font: inherit;
  --pm-plugin-text: #222222;
  --pm-plugin-accent: #e66a11;
  --pm-plugin-accent-hover: #cf5d0d;
  --pm-plugin-overlay: rgba(0, 0, 0, 0.55);
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: none;
  font-family: var(--pm-plugin-font);
  color: var(--pm-plugin-text);
}

.pm-pdf-book-modal.is-open {
  display: block;
}

.pm-pdf-book-backdrop {
  position: absolute;
  inset: 0;
  background: var(--pm-plugin-overlay);
}

.pm-pdf-book-wrap {
  --pm-book-height: 700px;
  position: absolute;
  top: var(--pm-modal-gap);
  left: 50%;
  transform: translateX(-50%);
  width: min(1440px, calc(100vw - 10px));
  height: calc(100dvh - (var(--pm-modal-gap) * 2));
  border: 1px solid #dedede;
  border-radius: 14px;
  background: var(--pm-modal-surface);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 2;
}

.pm-pdf-top-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

.pm-pdf-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 0;
  background: rgba(31, 31, 31, 0.55);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  z-index: 9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 0;
}

.pm-pdf-download-btn {
  font-size: 0;
}

.pm-pdf-icon-svg {
  width: 17px;
  height: 17px;
  display: block;
}

.pm-pdf-book-container {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 76px 18px 56px;
  overflow: hidden;
  background: #f6f6f6;
  flex: 1;
  min-height: 0;
  position: relative;
  touch-action: pan-y;
}

.pm-pdf-book-loading {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--pm-plugin-text);
  background: rgba(255, 255, 255, 0.92);
}

.pm-pdf-book-wrap.is-loading .pm-pdf-book-loading {
  display: flex;
}

.pm-pdf-swipe-hint {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.pm-pdf-book-wrap.show-swipe-hint .pm-pdf-swipe-hint {
  display: flex;
  animation: pm-pdf-hint-fade 1.8s ease forwards;
}

.pm-pdf-swipe-hint-text {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 10px 14px;
  border-radius: 999px;
}

@keyframes pm-pdf-hint-fade {
  0% { opacity: 0; }
  12% { opacity: 1; }
  72% { opacity: 1; }
  100% { opacity: 0; }
}

.pm-pdf-book-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid rgba(0, 0, 0, 0.15);
  border-top-color: var(--pm-plugin-accent);
  animation: pm-pdf-spin 0.8s linear infinite;
}

.pm-pdf-book-loading-text {
  font-size: 14px;
  font-weight: 600;
}

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

.pm-pdf-book-container::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 18px;
  bottom: 18px;
  width: 14px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0%, rgba(255, 255, 255, 0.25) 50%, rgba(0, 0, 0, 0.1) 100%);
  border-radius: 8px;
  pointer-events: none;
  z-index: 1;
}

.pm-pdf-book-pages {
  margin: 0 auto;
  overflow: hidden;
  position: relative;
  z-index: 2;
  cursor: grab;
  will-change: transform;
}

.pm-pdf-book-pages.is-grabbing {
  cursor: grabbing;
}

.pm-pdf-book-pages.is-dragging {
  transition: none !important;
}

.pm-pdf-page {
  background: #fff;
  box-shadow: inset 0 0 0 1px #ececec, 0 6px 18px rgba(0, 0, 0, 0.14);
}

.pm-pdf-page canvas {
  display: block;
}

.pm-pdf-hotspot {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  min-width: 48px;
  border: 0;
  background: rgba(18, 12, 9, 0.16);
  border-radius: 999px;
  z-index: 6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.pm-pdf-hotspot span {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-block;
  position: relative;
  color: transparent;
  background: rgba(18, 12, 9, 0.5);
  opacity: 0;
  transition: opacity .18s ease;
  pointer-events: none;
}

.pm-pdf-hotspot span::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border-top: 2px solid #fff;
  border-right: 2px solid #fff;
  transform-origin: center;
}

.pm-pdf-hotspot-prev span::before {
  transform: translate(-42%, -50%) rotate(-135deg);
}

.pm-pdf-hotspot-next span::before {
  transform: translate(-58%, -50%) rotate(45deg);
}

.pm-pdf-book-container:hover .pm-pdf-hotspot span { opacity: 1; }
.pm-pdf-hotspot-prev { left: 8px; }
.pm-pdf-hotspot-next { right: 8px; }

.pm-pdf-book-status {
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 8px 10px;
  min-height: 42px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  z-index: 9;
}

.pm-pdf-book-status-text {
  text-align: center;
}

.pm-pdf-mobile-nav-btn {
  display: none;
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(18, 13, 10, 0.32);
  color: #fff;
  font-size: 0;
  line-height: 1;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  padding: 0;
  position: relative;
}

.pm-pdf-mobile-nav-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 9px;
  border-top: 2px solid #fff;
  border-right: 2px solid #fff;
  transform-origin: center;
}

.pm-pdf-mobile-nav-btn[data-action='prev']::before {
  transform: translate(-42%, -50%) rotate(-135deg);
}

.pm-pdf-mobile-nav-btn[data-action='next']::before {
  transform: translate(-58%, -50%) rotate(45deg);
}

body.pm-pdf-modal-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .pm-pdf-book-wrap {
    width: calc(100vw - 4px);
    height: calc(100dvh - (var(--pm-modal-gap) * 2));
    border-radius: 10px;
  }

  .pm-pdf-book-container::before {
    display: none;
  }

  .pm-pdf-book-container {
    padding-top: 70px;
    padding-bottom: 12px;
    padding-left: 14px;
    padding-right: 14px;
    flex: 1 1 auto;
    min-height: 0;
  }

  .pm-pdf-hotspot {
    display: none;
  }

  .pm-pdf-book-status {
    min-height: 58px;
    padding: 10px 8px;
    flex: 0 0 58px;
    width: 100%;
  }

  .pm-pdf-mobile-nav-btn {
    display: inline-flex !important;
  }
}
