/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #0078d4;
  --primary-hover: #106ebe;
  --text-color: #323130;
  --bg-color: #f5f5f5; /* Light background */
  --border-color: #edebe9;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
  --book-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
  --footer-height: 56px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Main Viewer */
.viewer-container {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  background-color: var(--bg-color);
}

.pdf-viewer {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 2000px;
}

/* Page Containers */
.page-container {
  display: flex;
  gap: 0;
  align-items: center;
  justify-content: center;
  background: transparent;
  position: relative;
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

/* Book-like appearance */
.single-page {
  padding: 0;
  background: transparent;
}

.single-page canvas {
  box-shadow: var(--book-shadow);
  border-radius: 3px;
}

.double-page {
  padding: 0;
  gap: 0;
  position: relative;
  display: flex;
}

/* Create book spine effect */
.double-page::before {
  content: '';
  position: absolute;
  width: 6px;
  height: 100%;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.15) 0%,
    rgba(0, 0, 0, 0.08) 20%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(0, 0, 0, 0.08) 80%,
    rgba(0, 0, 0, 0.15) 100%
  );
  z-index: 10;
  pointer-events: none;
}

.page-container canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: white;
}

.left-page {
  position: relative;
  box-shadow:
    -5px 0 15px rgba(0, 0, 0, 0.1) inset,
    -10px 0 30px rgba(0, 0, 0, 0.15),
    0 10px 40px rgba(0, 0, 0, 0.2);
  border-radius: 3px 0 0 3px;
}

.right-page {
  position: relative;
  box-shadow:
    5px 0 15px rgba(0, 0, 0, 0.1) inset,
    10px 0 30px rgba(0, 0, 0, 0.15),
    0 10px 40px rgba(0, 0, 0, 0.2);
  border-radius: 0 3px 3px 0;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Error State */
.error-state {
  text-align: center;
  padding: 40px;
}

.error-state h2 {
  color: #a4262c;
  margin-bottom: 16px;
}

.error-state p {
  color: #605e5c;
}

/* Footer Navigation */
.brochure-footer {
  height: var(--footer-height);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 100;
}

.footer-content {
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

/* Footer Logo */
.footer-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.footer-logo img {
  height: 28px;
  width: auto;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.footer-logo img:hover {
  opacity: 1;
}

/* Navigation Controls */
.navigation-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Zoom Controls */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-btn {
  width: 38px;
  height: 38px;
  border: none;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.nav-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 120, 212, 0.3);
}

.nav-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.nav-btn:disabled {
  background: var(--border-color);
  cursor: not-allowed;
  opacity: 0.5;
  transform: scale(1);
}

/* Ripple effect on click */
.nav-btn::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transition: transform 0.5s ease;
}

.nav-btn:active:not(:disabled)::after {
  transform: translate(-50%, -50%) scale(2);
  transition: transform 0s;
}

.page-info {
  font-size: 14px;
  font-weight: 600;
  min-width: 60px;
  text-align: center;
  transition: all 0.3s ease;
  color: var(--text-color);
}

.page-info.updating {
  transform: scale(1.1);
  color: var(--primary-color);
}

.page-info .separator {
  margin: 0 8px;
  color: #8a8886;
}

/* Zoom Controls */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.control-btn {
  padding: 8px 14px;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-color);
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 13px;
  font-weight: 500;
}

.control-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

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

#zoomLevel {
  font-size: 13px;
  font-weight: 600;
  min-width: 45px;
  text-align: center;
  color: var(--text-color);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  :root {
    --footer-height: 52px;
  }

  .viewer-container {
    padding: 10px;
  }

  .footer-content {
    padding: 0 12px;
    gap: 12px;
  }

  .footer-logo img {
    height: 22px;
  }

  .navigation-controls {
    gap: 12px;
  }

  .zoom-controls {
    gap: 6px;
  }

  .control-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .nav-btn {
    width: 36px;
    height: 36px;
  }

  .page-info {
    font-size: 13px;
    min-width: 50px;
  }

  #zoomLevel {
    display: none;
  }

  .double-page {
    flex-direction: column;
    gap: 20px;
  }

  .double-page::before {
    display: none; /* Hide spine on mobile */
  }

  .left-page,
  .right-page {
    border-radius: 3px;
    box-shadow: var(--book-shadow);
  }

  .left-page {
    border-right: none;
  }
}

/* Touch Gestures */
@media (hover: none) and (pointer: coarse) {
  .page-container {
    touch-action: pan-x pan-y pinch-zoom;
  }
}

/* Fullscreen Mode */
:fullscreen .brochure-footer {
  display: none;
}

:fullscreen .viewer-container {
  padding: 0;
  background: #2a2a2a;
}

:fullscreen .pdf-viewer {
  padding: 20px;
}

/* Webkit/Blink fullscreen */
:-webkit-full-screen .brochure-footer {
  display: none;
}

:-webkit-full-screen .viewer-container {
  padding: 0;
  background: #2a2a2a;
}

:-webkit-full-screen .pdf-viewer {
  padding: 20px;
}

/* Print Styles */
@media print {
  .brochure-header,
  .brochure-footer {
    display: none;
  }

  .viewer-container {
    overflow: visible;
  }
}
