@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@500;700&family=Montserrat:wght@400;500;700&display=swap");

:root {
  --pdf-primary-color: #0a1c2e;
  --pdf-secondary-color: #06121f;
  --pdf-bg-color: #fff6ec;
  --pdf-surface: #ffffff;
  --pdf-text: #0f172a;
  --pdf-ext-secondary: #64748b;
  --pdf-border: #e2e8f0;
  --pdf-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --pdf-radius: 0.75rem;
  --pdf-error: #ef4444;
  --pdf-success: #22c55e;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none;
}

body {
  font-family: "Inter", sans-serif;
  background-color: var(--pdf-bg-color);
  color: var(--pdf-text);
  min-height: 100vh;
  overflow-x: hidden;
}

button {
  cursor: pointer;
  font-family: inherit;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* Top Navigation Bar */
.top-bar {
  background-color: var(--pdf-secondary-color);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo h1 {
  font-family: "Montserrat", serif;
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.primary-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn {
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.nav-btn:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.page-info {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: var(--pdf-radius);
  font-size: 0.875rem;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.top-right-controls {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.control-btn {
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.control-btn:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

/* Loading Bar Styles */
.loading-bar-container {
  position: relative;
  height: 4px;
  width: 100%;
  background-color: #e2e8f0;
  overflow: hidden;
  z-index: 110;
}

.loading-bar {
  position: absolute;
  height: 100%;
  width: 25%;
  background: linear-gradient(to right,
      var(--pdf-primary-color),
      var(--pdf-secondary-color),
      var(--pdf-primary-color),
      var(--pdf-secondary-color));
  animation: loading-animation 2s infinite ease-in-out;
}

@keyframes loading-animation {
  0% {
    left: -25%;
    width: 25%;
  }

  50% {
    left: 25%;
    width: 50%;
  }

  75% {
    left: 100%;
    width: 25%;
  }

  100% {
    left: 100%;
    width: 0;
  }
}

.loading-bar-container.hidden {
  display: none;
}

/* Search Panel */
.search-panel {
  background-color: var(--pdf-surface);
  padding: 1rem;
  border-bottom: 1px solid var(--pdf-border);
  display: none;
}

.search-panel.active {
  display: block;
}

.search-container {
  display: flex;
  gap: 0.5rem;
  max-width: 600px;
  margin: 0 auto;
}

.search-container button {
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  color: black;
  min-width: 40px;
  height: 40px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  gap: 0.5rem;
  transition: background-color 0.2s;
  border: 1px solid var(--pdf-border);
}

.search-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--pdf-border);
  border-radius: var(--pdf-radius);
  font-size: 0.875rem;
}

/* Main Content Area */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background-color: var(--pdf-surface);
  border-right: 1px solid var(--pdf-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--pdf-border);
}

.tab-btn {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: none;
  font-size: 0.875rem;
  color: var(--pdf-text-secondary);
  transition: all 0.2s;
}

.tab-btn.active {
  background-color: var(--pdf-surface);
  color: var(--pdf-text);
  border-bottom: 2px solid var(--pdf-primary-color);
}

.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
}

.tab-content.active {
  display: block;
}

/* Thumbnails */
.thumbnail-container {
  padding: 0.5rem;
  overflow-y: auto;
  height: 100%;
}

.thumbnail {
  margin-bottom: 0.5rem;
  border: 1px solid var(--pdf-border);
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.2s;
}

.thumbnail:hover {
  transform: translateY(-2px);
}

.thumbnail-page-number {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 2px 6px;
  font-size: 10px;
  border-radius: 4px;
}

.thumbnail-container-item {
  position: relative;
  margin-bottom: 10px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

.thumbnail-container-item.active {
  outline: 2px solid var(--pdf-primary-color);
}

/* Table of Contents */
.toc-container {
  padding: 0.5rem;
}

.toc-item {
  margin-bottom: 0.5rem;
}

.toc-btn {
  width: 100%;
  text-align: left;
  padding: 0.75rem;
  border: none;
  background: none;
  border-radius: var(--pdf-radius);
  font-size: 0.875rem;
  transition: background-color 0.2s;
}

.toc-btn:hover {
  background-color: var(--pdf-bg-color);
}

/* PDF Viewer */
.pdf-viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.pdf-container {
  flex: 1;
  overflow: auto;
  position: relative;
  background-color: var(--pdf-bg-color);
}

/* Floating Controls */
.floating-controls {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem;
}

.floating-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--pdf-primary-color);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.7;
  pointer-events: auto;
  transition: opacity 0.2s;
  position: fixed;
}

.floating-btn.next-btn {
  right: 1rem;
}

.floating-btn:hover {
  opacity: 1;
}

/* Bottom Toolbar */
.bottom-toolbar {
  height: 60px;
  background-color: var(--pdf-surface);
  border-top: 1px solid var(--pdf-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.zoom-controls button {
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  color: black;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.zoom-level {
  min-width: 60px;
  text-align: center;
  font-size: 0.875rem;
}

.additional-controls {
  display: flex;
  gap: 0.5rem;
}

.additional-controls button {
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  color: black;
  min-width: 40px;
  height: 40px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  gap: 0.5rem;
  transition: background-color 0.2s;
}

.download-btn {
  background-color: var(--pdf-primary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--pdf-radius);
  font-size: 0.875rem;
  transition: background-color 0.2s;
}

.download-btn:hover {
  background-color: var(--pdf-secondary-color);
}

/* Mobile Controls */
.mobile-controls {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--pdf-surface);
  border-top: 1px solid var(--pdf-border);
  padding: 0.5rem;
  justify-content: space-between;
  align-items: center;
  z-index: 90;
}

.mobile-controls button {
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  color: black;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.mobile-fab button {
  border-radius: 50%;
  color: white;
  border: none;
  box-shadow: var(--pdf-shadow);
  display: relative;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.three-dots {
  position: relative;
  display: inline-block;
}

.mobile-menu {
  position: absolute;
  top: 100%;
  right: 0;
  transform: translateY(5px);
  width: 150px;
  background-color: var(--pdf-surface);
  border-radius: var(--pdf-radius);
  box-shadow: var(--pdf-shadow);
  z-index: 900;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.mobile-menu.active {
  display: flex;
}

.mobile-menu button {
  white-space: nowrap;
  border: none;
  background: none;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--pdf-border);
  font-size: 0.875rem;
}

.mobile-menu button:last-child {
  border-bottom: none;
}

/* Notification */
.notification {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: 1rem;
  border-radius: var(--pdf-radius);
  background: var(--pdf-surface);
  box-shadow: var(--pdf-shadow);
  display: none;
  z-index: 999;
}

.notification.success {
  background: var(--pdf-success);
  color: white;
}

.notification.error {
  background: var(--pdf-error);
  color: white;
}

/* Responsive Styles */

@media screen and (max-width: 1500px) and (min-width: 600px) {
  .top-bar {
    justify-content: space-between;
    position: relative;
  }

  .top-right-controls {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 60px;
    bottom: 0;
    z-index: 80;
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .mobile-fab {
    display: block;
  }

  .floating-controls {
    display: none;
  }

  .logo h1 {
    font-size: 1.2rem;
  }
}

@media screen and (max-width: 1200px) and (min-width: 600px) {
  .top-bar {
    justify-content: space-between;
    position: relative;
  }

  .top-right-controls {
    margin-left: 0;
  }
}

@media screen and (min-width: 769px) {
  .top-bar {
    justify-content: space-between;
    position: relative;
  }

  .page-info {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Dark mode styles */
body.dark-mode {
  --pdf-bg-color: #0f172a;
  --pdf-surface: #1e293b;
  --pdf-text: #f8fafc;
  --pdf-text-secondary: #94a3b8;
  --pdf-border: #334155;
}

body.dark-mode .loading-bar-container {
  background-color: #334155;
}

body.dark-mode .thumbnail-page-number {
  background-color: rgba(255, 255, 255, 0.7);
  color: black;
}

/* Print styles */
@media print {

  .top-bar,
  .sidebar,
  .bottom-toolbar,
  .mobile-controls,
  .mobile-fab,
  .mobile-menu,
  .floating-controls,
  .notification,
  .search-panel,
  .loading-bar-container {
    display: none !important;
  }

  .pdf-container {
    box-shadow: none;
    padding: 0;
  }

  .main-content {
    display: block;
  }
}

.download-btn {
  display: none !important;
}

#pdf-render {
  box-shadow: var(--pdf-shadow);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: pixelated;
}

.pdf-container {
  user-select: none;
  -webkit-user-select: none;
}

.text-highlight-overlay {
  position: absolute;
  background-color: rgba(255, 255, 0, 0.4);
  border-radius: 2px;
  box-shadow: 0 0 4px rgba(255, 200, 0, 0.5);
  pointer-events: none;
  animation: highlight-pulse 1.5s infinite alternate;
}

@keyframes highlight-pulse {
  from {
    background-color: rgba(255, 255, 0, 0.4);
  }

  to {
    background-color: rgba(255, 255, 0, 0.6);
  }
}

.search-nav-buttons {
  display: flex;
  justify-content: center;
  margin-top: 10px;
  gap: 10px;
}

.search-nav-buttons button {
  background-color: var(--pdf-primary-color);
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: var(--pdf-radius);
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}

.search-nav-buttons button:hover {
  background-color: var(--pdf-secondary-color);
}

#match-counter {
  padding: 0 10px;
  font-size: 0.8rem;
  color: var(--pdf-text-secondary);
}

.zoom-slider {
  width: 120px;
  margin: 0 10px;
  display: none;
}

@media (min-width: 768px) {
  .zoom-slider {
    display: inline-block;
  }
}

.bottom-toolbar button.active {
  background-color: #e0e0e0;
  border-color: #bbbbbb;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dark-mode .bottom-toolbar button.active {
  background-color: #555;
  border-color: #777;
}

.pdf-container.fit-to-width {
  padding-top: 80px;
  padding-bottom: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
}

.pdf-canvas-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100%;
}

.pdf-container.fit-to-width #pdf-render {
  margin-top: 10px;
}

.main-content:not(.with-sidebar) .sidebar {
  display: none;
}

@media (min-width: 720px) {
  .mobile-controls {
    display: none;
  }
}

@media (max-width: 720px) {
  .main-content .sidebar {
    position: fixed;
    left: 0;
    top: 60px;
    bottom: 0;
    width: 250px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 80;
  }

  .main-content.with-sidebar .sidebar {
    transform: translateX(0);
  }

  .top-right-controls {
    margin: 0 auto;
  }

  .page-info,
  .primary-controls {
    display: none;
  }

  .bottom-toolbar {
    display: none;
  }
}