/**
 * Hi-Kataloog Premium Magazine Viewer v0.5.3
 * Double-page spread with search functionality
 * 
 * v0.5.2: Added pointer-events: none to prevent click blocking when hidden
 * v0.5.0: Removed duplicate .hk-text-layer .highlight rules (now only mark.highlight)
 */

/* ============================================
   MAGAZINE VIEWER - Base
   ============================================ */

.hk-magazine-viewer {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #0d0d0f;
  display: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  pointer-events: none; /* CRITICAL: Don't block clicks when hidden */
}

.hk-magazine-viewer.is-open {
  display: block;
  pointer-events: auto; /* Re-enable when open */
}

.hk-viewer-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ============================================
   TOOLBAR - Top & Bottom
   ============================================ */

.hk-toolbar {
  position: relative;
  z-index: 100;
  background: rgba(20, 20, 25, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hk-toolbar--top {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hk-toolbar--bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: none;
}

/* Auto-hide toolbars in fullscreen (desktop only) */
@media (min-width: 768px) {
  .hk-viewer-container.is-fullscreen:not(:hover) .hk-toolbar--top {
    transform: translateY(-100%);
    opacity: 0;
  }

  .hk-viewer-container.is-fullscreen:not(:hover) .hk-toolbar--bottom {
    transform: translateY(100%);
    opacity: 0;
  }
}

/* Mobile: Keep toolbar always visible in fullscreen */
@media (max-width: 767px) {
  .hk-viewer-container.is-fullscreen .hk-toolbar--top,
  .hk-viewer-container.is-fullscreen .hk-toolbar--bottom {
    transform: none !important;
    opacity: 1 !important;
  }
}

.hk-toolbar__brand {
  color: #f4f4f4;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0.9;
}

.hk-toolbar__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hk-toolbar__section {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 150px;
}

.hk-toolbar__section--left {
  justify-content: flex-start;
}

.hk-toolbar__section--center {
  justify-content: center;
  flex: 1;
}

.hk-toolbar__section--right {
  justify-content: flex-end;
}

/* ============================================
   FLOATING ACTIONS - Top Right Corner
   ============================================ */

.hk-floating-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Close button - Top Left Corner */
.hk-float-btn--close {
  position: fixed !important;
  top: 16px !important;
  left: 16px !important;
  right: auto !important;
  z-index: 1001 !important;
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

.hk-float-btn {
  appearance: none;
  border: none;
  background: rgba(20, 20, 25, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #f4f4f4;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.hk-float-btn:hover {
  background: rgba(30, 30, 35, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

.hk-float-btn:active {
  transform: scale(0.98);
}

.hk-float-btn--close:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
}

/* ============================================
   SEARCH BAR
   ============================================ */

.hk-search-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.hk-search-container.is-visible {
  max-width: 350px;
  opacity: 1;
  padding: 6px 12px;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.hk-search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #f4f4f4;
  font-size: 13px;
  padding: 6px 8px;
  outline: none;
  min-width: 180px;
}

.hk-search-input::placeholder {
  color: rgba(244, 244, 244, 0.4);
}

.hk-search-results {
  color: #f4f4f4;
  font-size: 13px;
  opacity: 0.7;
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
}

.hk-search-nav {
  display: flex;
  gap: 4px;
}

.hk-search-nav-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: #f4f4f4;
  opacity: 0.6;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hk-search-nav-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.hk-search-nav-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

/* ============================================
   TOOL BUTTONS
   ============================================ */

.hk-tool-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: #f4f4f4;
  opacity: 0.75;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
}

.hk-tool-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.hk-tool-btn:active {
  transform: translateY(0);
}

.hk-tool-btn.is-active {
  background: rgba(96, 165, 250, 0.2);
  color: #60a5fa;
  opacity: 1;
}

.hk-tool-btn--close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.hk-tool-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.hk-control-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 10px;
}

.hk-zoom-level,
.hk-page-info {
  color: #f4f4f4;
  font-size: 14px;
  font-weight: 500;
  min-width: 60px;
  text-align: center;
  opacity: 0.9;
}

.hk-page-info {
  font-variant-numeric: tabular-nums;
}

/* ============================================
   SPREAD CONTAINER - Main viewing area
   ============================================ */

.hk-spread-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: 
    radial-gradient(ellipse at center, rgba(40,40,45,0.3) 0%, rgba(13,13,15,1) 70%);
}

/* ============================================
   NAVIGATION ARROWS
   ============================================ */

.hk-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #f4f4f4;
  width: 60px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: all 0.3s ease;
  border-radius: 12px;
}

/* Desktop: Show arrows on hover */
@media (min-width: 768px) {
  .hk-spread-container:hover .hk-nav-arrow {
    opacity: 0.7;
  }
  
  .hk-nav-arrow:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-50%) scale(1.05);
  }
}

/* Mobile/Touch: Always show arrows (no hover) */
@media (max-width: 767px) {
  .hk-nav-arrow {
    opacity: 0.5 !important;
    width: 48px;
    height: 64px;
  }
  
  .hk-nav-arrow:active {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.2);
  }
}

.hk-nav-arrow:disabled {
  opacity: 0.2 !important;
  cursor: not-allowed;
}

.hk-nav-arrow--left {
  left: 20px;
}

.hk-nav-arrow--right {
  right: 20px;
}

/* ============================================
   SPREAD - Double page layout
   ============================================ */

.hk-spread {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  max-width: 100%;
  max-height: 100%;
  position: relative;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  perspective: 2000px;
}

/* Page flip animation */
.hk-spread.is-flipping {
  animation: pageFlip 0.4s ease-out;
}

@keyframes pageFlip {
  0% {
    transform: scale(0.98) rotateY(-2deg);
    opacity: 0.9;
  }
  50% {
    transform: scale(0.96) rotateY(0deg);
    opacity: 0.7;
  }
  100% {
    transform: scale(1) rotateY(0deg);
    opacity: 1;
  }
}

/* ============================================
   PAGE - Individual page styling
   ============================================ */

.hk-page {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  box-shadow: 
    0 0 60px rgba(0, 0, 0, 0.6),
    0 20px 40px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.hk-page--left {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  box-shadow: 
    0 0 60px rgba(0, 0, 0, 0.6),
    0 20px 40px rgba(0, 0, 0, 0.4),
    inset -20px 0 30px -20px rgba(0, 0, 0, 0.15);
}

.hk-page--right {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  box-shadow: 
    0 0 60px rgba(0, 0, 0, 0.6),
    0 20px 40px rgba(0, 0, 0, 0.4),
    inset 20px 0 30px -20px rgba(0, 0, 0, 0.15);
}

.hk-page__inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hk-page__canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  position: relative;
  z-index: 1;
}

/* ============================================
   TEXT LAYER - For search and selection
   ============================================ */

.hk-text-layer {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  opacity: 0.2;
  line-height: 1;
  z-index: 2;
  pointer-events: none;
}

.hk-text-layer > span {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
}

/* Highlight styles moved to mark.highlight at line 1060 */

@keyframes highlightPulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.6;
  }
}

/* ============================================
   BINDING - Realistic book spine effect
   ============================================ */

.hk-binding {
  width: 8px;
  height: 100%;
  position: relative;
  z-index: 10;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.4) 0%,
    rgba(0, 0, 0, 0.15) 30%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(0, 0, 0, 0.15) 70%,
    rgba(0, 0, 0, 0.4) 100%
  );
  box-shadow: 
    inset 2px 0 4px rgba(0, 0, 0, 0.3),
    inset -2px 0 4px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

/* ============================================
   LOADING STATE
   ============================================ */

.hk-page__loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 5;
}

.hk-page.is-loaded .hk-page__loading {
  opacity: 0;
}

.hk-spinner-ring {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top-color: #111;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================
   RESPONSIVE - Mobile optimizations
   ============================================ */

@media (max-width: 767px) {
  /* Single page on mobile only - tablets get full features */
  .hk-page--left {
    display: none;
  }
  
  .hk-binding {
    display: none;
  }
  
  .hk-page--right {
    border-radius: 4px;
    box-shadow: 
      0 0 60px rgba(0, 0, 0, 0.6),
      0 20px 40px rgba(0, 0, 0, 0.4);
  }
  
  .hk-nav-arrow {
    width: 50px;
    height: 60px;
  }
  
  .hk-nav-arrow--left {
    left: 10px;
  }
  
  .hk-nav-arrow--right {
    right: 10px;
  }
  
  .hk-toolbar {
    padding: 8px 16px;
  }
  
  .hk-toolbar__section {
    min-width: auto;
  }

  .hk-search-container.is-visible {
    max-width: 250px;
  }

  .hk-search-input {
    min-width: 150px;
  }
}

@media (max-width: 640px) {
  .hk-spread-container {
    padding: 10px;
  }
  
  .hk-control-group {
    gap: 2px;
    padding: 2px;
  }
  
  .hk-tool-btn {
    min-width: 36px;
    min-height: 36px;
    padding: 6px;
  }
  
  .hk-zoom-level {
    font-size: 12px;
    min-width: 50px;
  }
  
  .hk-toolbar__brand .hk-brand-text {
    display: none;
  }

  .hk-search-container.is-visible {
    max-width: 180px;
  }

  .hk-search-input {
    min-width: 100px;
    font-size: 13px;
  }

  .hk-search-results {
    font-size: 12px;
    min-width: 40px;
  }
}

/* ============================================
   RETINA / HIGH DPI
   ============================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .hk-page__canvas {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* ============================================
   FULLSCREEN MODE
   ============================================ */

.hk-viewer-container.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 999999;
}

.hk-viewer-container.is-fullscreen .hk-spread-container {
  padding: 10px;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .hk-magazine-viewer {
    display: none !important;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.hk-tool-btn:focus-visible,
.hk-search-input:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .hk-spread,
  .hk-tool-btn,
  .hk-nav-arrow,
  .hk-page__loading,
  .hk-search-container {
    transition: none !important;
    animation: none !important;
  }
}

/* ============================================
   SEARCH PANEL (New inline toolbar style)
   ============================================ */

.hk-search-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  background: rgba(20, 20, 25, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px 12px 0 0;
  padding: 8px 16px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 99;
  min-width: 400px;
  max-width: 90vw;
}

.hk-search-panel.is-visible {
  transform: translateX(-50%) translateY(-100%);
}

.hk-search-panel__inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hk-search-panel .hk-search-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #f4f4f4;
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  min-width: 200px;
}

.hk-search-panel .hk-search-input:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(96, 165, 250, 0.5);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.hk-search-panel .hk-search-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 8px;
  border-radius: 8px;
}

.hk-search-panel .hk-search-results {
  color: #f4f4f4;
  font-size: 13px;
  opacity: 0.7;
  min-width: 50px;
  text-align: center;
}

.hk-search-panel .hk-search-nav-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: #f4f4f4;
  opacity: 0.6;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hk-search-panel .hk-search-nav-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.hk-search-panel .hk-search-nav-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.hk-search-panel .hk-search-close {
  appearance: none;
  border: none;
  background: transparent;
  color: #f4f4f4;
  opacity: 0.6;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hk-search-panel .hk-search-close:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* ============================================
   TOOLBAR RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .hk-toolbar {
    padding: 6px 12px;
    gap: 8px;
  }
  
  .hk-search-panel {
    min-width: 90vw;
    padding: 8px 12px;
  }
  
  .hk-search-panel .hk-search-input {
    min-width: 150px;
    font-size: 12px;
  }
  
  .hk-search-panel .hk-search-results {
    font-size: 12px;
    min-width: 40px;
  }
}

@media (max-width: 480px) {
  .hk-toolbar {
    padding: 4px 8px;
    gap: 6px;
  }
  
  .hk-tool-btn {
    min-width: 32px;
    min-height: 32px;
    padding: 5px 8px;
  }
  
  .hk-control-group {
    gap: 2px;
    padding: 3px;
  }
  
  .hk-zoom-level,
  .hk-page-info {
    font-size: 11px;
    min-width: 45px;
  }
  
  .hk-search-panel {
    border-radius: 8px 8px 0 0;
    padding: 6px 10px;
  }
  
  .hk-search-panel__inner {
    gap: 8px;
  }
  
  .hk-search-panel .hk-search-input {
    min-width: 120px;
    font-size: 11px;
    padding: 6px 10px;
  }
  
  .hk-search-panel .hk-search-nav {
    padding: 3px 6px;
    gap: 4px;
  }
}

/* ============================================
   VIEW MODE - SINGLE PAGE
   ============================================ */

/* Single page mode - hide left page and binding */
.hk-spread--single-page .hk-page--left {
  display: none;
}

.hk-spread--single-page .hk-binding {
  display: none;
}

.hk-spread--single-page .hk-page--right {
  flex: 1;
  max-width: 90vw;
  margin: 0 auto;
}

/* View toggle button icons */
.hk-tool-btn--view .hk-icon-spread {
  display: block;
}

.hk-tool-btn--view .hk-icon-single {
  display: none;
}

.hk-tool-btn--view.is-single .hk-icon-spread {
  display: none;
}

.hk-tool-btn--view.is-single .hk-icon-single {
  display: block;
}

/* Mobile: always single page */
@media (max-width: 767px) {
  .hk-spread {
    flex-direction: column;
  }
  
  .hk-page--left {
    display: none !important;
  }
  
  .hk-binding {
    display: none !important;
  }
  
  .hk-page--right {
    flex: 1;
    max-width: 100%;
  }
  
  /* Hide view toggle only on actual mobile */
  .hk-tool-btn--view {
    display: none !important;
  }
}

/* Tablet/Desktop: Show toggle button and allow both view modes */
@media (min-width: 768px) {
  .hk-tool-btn--view {
    display: flex !important;
  }
}

/* View toggle - keep neutral color in both states */
.hk-tool-btn--view,
.hk-tool-btn--view.is-single {
  background: transparent;
  color: #f4f4f4;
  opacity: 0.75;
}

.hk-tool-btn--view:hover,
.hk-tool-btn--view.is-single:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

/* Search input wrapper with clear button */
.hk-search-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.hk-search-panel .hk-search-input-wrapper .hk-search-input {
  padding-right: 32px;
}

.hk-search-clear {
  position: absolute;
  right: 8px;
  appearance: none;
  border: none;
  background: transparent;
  color: #f4f4f4;
  opacity: 0.5;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hk-search-clear:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

/* Mark element for precise highlighting */
.hk-text-layer mark.highlight {
  background: rgba(255, 235, 59, 0.65);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 193, 7, 0.8);
  transition: all 0.2s ease;
  padding: 1px 0;
  color: inherit;
  position: relative;
  z-index: 5;
  display: inline-block;
}

.hk-text-layer mark.highlight.selected {
  background: rgba(255, 87, 34, 0.95);
  box-shadow: 
    0 0 0 2px rgba(255, 87, 34, 1), 
    0 0 16px rgba(255, 87, 34, 0.7),
    0 0 32px rgba(255, 87, 34, 0.3);
  animation: highlightPulse 0.6s ease-out;
  z-index: 10;
  transform: scale(1.02);
  font-weight: 500;
}

/* Search options (case-sensitive, whole word) */
.hk-search-options {
  display: flex;
  gap: 4px;
}

.hk-search-option {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.2s ease;
  user-select: none;
}

.hk-search-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.hk-search-option input[type="checkbox"] {
  display: none;
}

.hk-search-option span {
  color: #f4f4f4;
  opacity: 0.5;
  font-size: 12px;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.hk-search-option input[type="checkbox"]:checked + span {
  opacity: 1;
  color: #60a5fa;
}

/* ============================================
   PAGE JUMP INPUT
   ============================================ */
.hk-page-jump {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 8px;
  border-radius: 6px;
}

.hk-page-jump-input {
  width: 50px;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #f4f4f4;
  font-size: 13px;
  text-align: center;
  transition: all 0.2s ease;
}

.hk-page-jump-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.15);
  border-color: #60a5fa;
}

.hk-page-jump-input::placeholder {
  color: rgba(244, 244, 244, 0.4);
}

.hk-page-jump-separator {
  color: rgba(244, 244, 244, 0.5);
  font-size: 13px;
}

.hk-page-jump-total {
  color: #f4f4f4;
  font-size: 13px;
  opacity: 0.7;
  min-width: 20px;
}

/* ============================================
   PDF INFO PANEL
   ============================================ */
.hk-info-panel {
  position: fixed;
  top: 60px;
  right: -320px;
  width: 300px;
  max-height: calc(100vh - 120px);
  background: rgba(20, 20, 25, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px 0 0 12px;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  padding: 20px;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 110;
  overflow-y: auto;
}

.hk-info-panel.is-visible {
  right: 0;
}

.hk-info-panel__inner {
  position: relative;
}

.hk-info-close {
  position: absolute;
  top: -8px;
  right: -8px;
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #f4f4f4;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.hk-info-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.hk-info-title {
  color: #f4f4f4;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px 0;
}

.hk-info-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hk-info-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hk-info-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.hk-info-label {
  color: rgba(244, 244, 244, 0.6);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hk-info-value {
  color: #f4f4f4;
  font-size: 14px;
  word-break: break-word;
}

/* ============================================
   PRINT DIALOG
   ============================================ */
.hk-print-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 400px;
  max-width: 90vw;
  background: rgba(20, 20, 25, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 120;
}

.hk-print-dialog.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: all;
}

.hk-print-dialog__inner {
  position: relative;
}

.hk-print-close {
  position: absolute;
  top: -12px;
  right: -12px;
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #f4f4f4;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.hk-print-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.hk-print-title {
  color: #f4f4f4;
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 20px 0;
}

.hk-print-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.hk-print-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.2s ease;
}

.hk-print-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.hk-print-option input[type="radio"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.hk-print-option input[type="radio"]:checked {
  border-color: #60a5fa;
}

.hk-print-option input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #60a5fa;
}

.hk-print-option span {
  color: #f4f4f4;
  font-size: 14px;
}

.hk-print-option--custom {
  flex-wrap: wrap;
}

.hk-print-range-input {
  flex: 1;
  min-width: 150px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #f4f4f4;
  font-size: 13px;
  margin-top: 8px;
}

.hk-print-range-input:focus {
  outline: none;
  border-color: #60a5fa;
  background: rgba(255, 255, 255, 0.15);
}

.hk-print-btn {
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.hk-print-btn:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.hk-print-btn:active {
  transform: translateY(0);
}

/* ============================================
   SHARE NOTIFICATION
   ============================================ */
.hk-share-notification {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(20, 20, 25, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  color: #f4f4f4;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 130;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}

.hk-share-notification.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   RESPONSIVE - MOBILE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
  .hk-page-jump {
    display: none; /* Hide on mobile - too cluttered */
  }
  
  .hk-info-panel {
    width: 100%;
    right: -100%;
    top: 0;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .hk-info-panel.is-visible {
    right: 0;
  }
  
  .hk-print-dialog {
    width: 95vw;
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .hk-print-title {
    font-size: 16px;
  }
  
  .hk-print-option {
    padding: 6px 10px;
  }
  
  .hk-print-btn {
    padding: 10px 16px;
    font-size: 13px;
  }
}

/* ============================================
   BOOKMARKS & TOC PANEL
   ============================================ */
.hk-bookmarks-panel {
  position: fixed;
  top: 60px;
  left: -320px;
  width: 300px;
  max-height: calc(100vh - 120px);
  background: rgba(20, 20, 25, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 0 12px 12px 0;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
  padding: 20px;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 110;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.hk-bookmarks-panel.is-visible {
  left: 0;
}

.hk-bookmarks-panel__inner {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hk-bookmarks-close {
  position: absolute;
  top: -8px;
  right: -8px;
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #f4f4f4;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.hk-bookmarks-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.hk-bookmarks-title {
  color: #f4f4f4;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px 0;
}

.hk-bookmarks-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hk-bookmarks-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: rgba(244, 244, 244, 0.6);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.hk-bookmarks-tab:hover {
  color: #f4f4f4;
}

.hk-bookmarks-tab.is-active {
  color: #60a5fa;
  border-bottom-color: #60a5fa;
}

.hk-bookmarks-content {
  display: none;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow-y: auto;
}

.hk-bookmarks-content.is-active {
  display: flex;
}

.hk-bookmark-add {
  appearance: none;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #f4f4f4;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.hk-bookmark-add:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: #60a5fa;
  color: #60a5fa;
}

.hk-bookmarks-list,
.hk-toc-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hk-bookmarks-empty,
.hk-toc-empty {
  color: rgba(244, 244, 244, 0.5);
  font-size: 13px;
  text-align: center;
  padding: 20px 10px;
}

.hk-bookmark-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 4px;
  transition: all 0.2s ease;
}

.hk-bookmark-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.hk-bookmark-goto {
  flex: 1;
  appearance: none;
  border: none;
  background: transparent;
  color: #f4f4f4;
  padding: 8px 10px;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s ease;
}

.hk-bookmark-goto:hover {
  color: #60a5fa;
}

.hk-bookmark-delete {
  appearance: none;
  border: none;
  background: transparent;
  color: rgba(244, 244, 244, 0.4);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.hk-bookmark-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.hk-toc-item {
  margin-bottom: 2px;
}

.hk-toc-link {
  appearance: none;
  border: none;
  background: transparent;
  color: #f4f4f4;
  padding: 8px 10px;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  display: block;
  width: 100%;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.hk-toc-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #60a5fa;
}

/* Custom scrollbar for bookmarks panel */
.hk-bookmarks-panel::-webkit-scrollbar,
.hk-bookmarks-content::-webkit-scrollbar {
  width: 6px;
}

.hk-bookmarks-panel::-webkit-scrollbar-track,
.hk-bookmarks-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.hk-bookmarks-panel::-webkit-scrollbar-thumb,
.hk-bookmarks-content::-webkit-scrollbar-thumb {
  background: rgba(96, 165, 250, 0.3);
  border-radius: 3px;
}

.hk-bookmarks-panel::-webkit-scrollbar-thumb:hover,
.hk-bookmarks-content::-webkit-scrollbar-thumb:hover {
  background: rgba(96, 165, 250, 0.5);
}

/* Auto-generate TOC button */
.hk-toc-generate {
  appearance: none;
  border: 1px dashed rgba(96, 165, 250, 0.4);
  background: rgba(96, 165, 250, 0.05);
  color: #60a5fa;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  margin-bottom: 12px;
  width: 100%;
}

.hk-toc-generate:hover:not(:disabled) {
  background: rgba(96, 165, 250, 0.1);
  border-color: #60a5fa;
}

.hk-toc-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* TOC item max-width to prevent overflow */
.hk-toc-item {
  max-width: 100%;
}

.hk-toc-link {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  justify-content: space-between;
}

.hk-toc-link-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hk-toc-link-page {
  font-size: 11px;
  opacity: 0.6;
  margin-left: 8px;
  flex-shrink: 0;
}

.hk-toc-item--auto {
  opacity: 0.95;
}

@media (max-width: 768px) {
  .hk-bookmarks-panel {
    width: 100%;
    left: -100%;
    top: 0;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .hk-bookmarks-panel.is-visible {
    left: 0;
  }
}

/* ============================================
   STANDALONE WINDOW SPECIFIC STYLES
   ============================================ */

/* When viewer is in standalone mode (new window) */
body.hk-standalone {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #1a1a1a;
  color: #fff;
  overflow: hidden;
}

/* Force viewer fullscreen in standalone */
body.hk-standalone .hk-magazine-viewer {
  display: block !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 1 !important;
}

/* Standalone loading indicator */
.hk-loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 10;
  pointer-events: none;
}

.hk-loading__spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: #4CAF50;
  border-radius: 50%;
  animation: hk-spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.hk-loading__text {
  color: rgba(255,255,255,0.7);
  font-size: 16px;
  font-weight: 500;
}

.hk-loading__text small {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  opacity: 0.7;
}
