/* Google Fonts - Inter and Outfit */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  /* System Colors */
  --bg-color: #0b0c10;
  --bg-pattern: radial-gradient(circle at 50% 50%, #151821 0%, #0b0c10 100%);
  --panel-bg: rgba(20, 24, 33, 0.7);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --accent-color: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.4);
  
  --success-color: #10b981;
  --danger-color: #ef4444;
  
  /* Layout values */
  --header-height: 64px;
  --footer-height: 60px;
  --sidebar-width: 300px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Scrollbars for Chrome/Edge/Safari */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-color);
  background-image: var(--bg-pattern);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand-text {
  font-family: 'Outfit', sans-serif;
}

/* Glassmorphism utility classes */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
}

/* Main Layout */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  position: relative;
}

.app-header {
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  position: relative;
  z-index: 130;
  border-bottom: 1px solid var(--panel-border);
  flex-shrink: 0;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-bottom-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.app-header.hidden {
  height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  opacity: 0 !important;
  border-bottom-color: transparent !important;
  pointer-events: none;
  overflow: hidden !important;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-color), #a855f7);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  box-shadow: 0 0 15px var(--accent-glow);
}

.brand-text {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(to right, #ffffff, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
}

.controls-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.control-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  user-select: none;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

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

.control-btn.active {
  background: var(--accent-color);
  box-shadow: 0 0 10px var(--accent-glow);
  border-color: var(--accent-color);
}

/* File Upload styling */
.file-upload-wrapper {
  position: relative;
}

#file-input {
  display: none;
}

.upload-btn {
  background: linear-gradient(135deg, var(--accent-color), #818cf8);
  border: none;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.upload-btn:hover {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
}

.file-name-display {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
  position: absolute;
  bottom: -16px;
  left: 0;
  text-align: center;
  width: 100%;
}

/* Drop Zone overlay when dragging files */
.drag-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 12, 16, 0.9);
  border: 3px dashed var(--accent-color);
  z-index: 1000;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(8px);
}

.drag-overlay.active {
  display: flex;
}

.drag-overlay-content {
  text-align: center;
  pointer-events: none;
}

.drag-overlay-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  animation: pulse 1.5s infinite;
}

/* Premium Custom Dropdown */
.custom-dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  justify-content: space-between;
}

.dropdown-menu {
  background: #141821 !important; /* Solid opaque color */
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  z-index: 200;
  border-radius: 8px;
  overflow: hidden;
  padding: 6px;
  flex-direction: column;
  gap: 2px;
}

.dropdown-menu.show {
  display: flex;
}

.dropdown-item {
  background: transparent;
  border: none;
  text-align: left;
  padding: 8px 12px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: all 0.15s ease;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.dropdown-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  font-weight: 600;
  border-left: 2px solid var(--accent-color);
}

.dropdown-divider {
  height: 1px;
  background: var(--panel-border);
  margin: 4px 0;
}

/* Zoom controls group */
.zoom-controls {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 2px;
}

/* Custom Zoom Dropdown inside Zoom Controls */
#zoom-dropdown-container .dropdown-trigger {
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 0 8px;
  min-width: 65px;
  height: 32px;
  font-size: 0.8rem;
  font-weight: 600;
  gap: 4px;
  justify-content: center;
  cursor: pointer;
  display: flex;
  align-items: center;
  user-select: none;
}

#zoom-dropdown-container .dropdown-trigger:hover {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

#zoom-dropdown-container .dropdown-menu {
  background: #141821 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  top: calc(100% + 4px);
  right: 50%;
  transform: translateX(50%);
  min-width: 130px;
}

.zoom-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.zoom-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.zoom-display {
  font-size: 0.8rem;
  font-weight: 600;
  width: 54px;
  text-align: center;
  user-select: none;
}

.zoom-divider {
  width: 1px;
  height: 16px;
  background: var(--panel-border);
}

/* Middle Layout (Sidebar + Main Viewport) */
.main-layout {
  display: flex;
  flex: 1;
  min-height: 0; /* Important for scroll container behavior in flexbox */
  position: relative;
  overflow: hidden;
}

/* Sidebar styling */
.app-sidebar {
  width: var(--sidebar-width);
  height: 100%;
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 90;
  background: rgba(13, 15, 20, 0.85);
  flex-shrink: 0;
}

.app-sidebar.collapsed {
  transform: translateX(-100%);
  margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--panel-border);
  padding: 8px 12px 0 12px;
  gap: 8px;
}

.sidebar-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  border-radius: 4px 4px 0 0;
}

.sidebar-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-tab-btn.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
  background: rgba(99, 102, 241, 0.05);
}

.sidebar-content-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* Table of Contents / Outline list */
.outline-list {
  list-style: none;
}

.outline-item {
  margin-bottom: 4px;
}

.outline-link {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.15s ease;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.outline-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  padding-left: 14px;
}

.outline-link.active {
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.15);
  border-left: 3px solid var(--accent-color);
  font-weight: 500;
}

.outline-item-indent-1 { padding-left: 12px; }
.outline-item-indent-2 { padding-left: 24px; }
.outline-item-indent-3 { padding-left: 36px; }

/* Thumbnails list */
.thumbnails-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.thumbnail-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.thumbnail-wrapper:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

.thumbnail-wrapper.active {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.4);
}

.thumbnail-box {
  width: 100%;
  aspect-ratio: 1 / 1.414; /* PDF Aspect ratio */
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--panel-border);
  position: relative;
}

.thumbnail-box canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-num {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.thumbnail-wrapper.active .thumbnail-num {
  color: var(--accent-color);
  font-weight: 700;
}

.placeholder-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 40px;
}

/* Sidebar toggle button (floating edge) */
.sidebar-toggle-edge {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 20px;
  height: 60px;
  background: rgba(20, 24, 33, 0.9);
  border: 1px solid var(--panel-border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 105;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.sidebar-toggle-edge:hover {
  width: 24px;
  color: var(--text-primary);
  background: var(--accent-color);
}

/* Mobile Sidebar Backdrop Overlay */
.sidebar-backdrop {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 85;
  backdrop-filter: blur(4px);
}

.sidebar-backdrop.show {
  display: block;
}

/* Viewport Area */
.viewport-container {
  flex: 1;
  height: 100%;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: safe center;
  padding: 30px;
  position: relative;
  outline: none;
}

.welcome-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.welcome-screen {
  align-self: center;
  max-width: 480px;
  text-align: center;
  padding: 40px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.about-card, .faq-card {
  width: 100%;
  padding: 30px;
  border-radius: 16px;
  text-align: left;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 20px;
  background: linear-gradient(to right, #ffffff, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.about-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.about-content strong {
  color: #fff;
  font-weight: 600;
}

/* FAQ Accordion Styling */
.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.05);
}

.faq-item.active {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.1);
}

.faq-question {
  width: 100%;
  background: transparent;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  outline: none;
  gap: 12px;
}

.faq-arrow {
  color: var(--text-secondary);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s;
  flex-shrink: 0;
}

.faq-item.active .faq-arrow {
  transform: rotate(180deg);
  color: var(--accent-color);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  padding: 0 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-item.active .faq-answer {
  max-height: 200px;
  padding: 0 20px 20px 20px;
}

.welcome-icon {
  font-size: 4rem;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent-color), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: float 4s ease-in-out infinite;
}

.welcome-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
}

.welcome-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.dropzone-area {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 30px;
  width: 100%;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.01);
}

.dropzone-area:hover {
  border-color: var(--accent-color);
  background: rgba(99, 102, 241, 0.05);
}

.dropzone-icon {
  font-size: 2rem;
  color: var(--accent-color);
  margin-bottom: 12px;
}

/* Floating Page Turn Buttons (Glassmorphic) */
.nav-edge-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(20, 24, 33, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 110;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  outline: none;
}

.nav-edge-btn.left {
  left: 24px;
}

/* Offset left button when the sidebar is open (not collapsed) on desktop */
.app-sidebar:not(.collapsed) ~ .nav-edge-btn.left {
  left: calc(var(--sidebar-width) + 24px);
}

.nav-edge-btn.right {
  right: 24px;
}

.nav-edge-btn:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.4);
  color: #fff;
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

.nav-edge-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.nav-edge-btn:disabled {
  opacity: 0.15;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.04);
}

/* PDF Page Container & Filters */
.pdf-page-wrapper {
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  background-color: #ffffff;
  transform-origin: center center;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  opacity: 1;
  touch-action: auto; /* Allow both vertical and horizontal native drag scrolling when zoomed */
  flex-shrink: 0; /* Prevent flex container from shrinking the width when zoomed beyond viewport */
}

.pdf-page-wrapper.page-flip-next {
  animation: slideOutLeft 0.25s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

.pdf-page-wrapper.page-flip-prev {
  animation: slideOutRight 0.25s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

.pdf-page-wrapper.page-enter-next {
  animation: slideInRight 0.25s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

.pdf-page-wrapper.page-enter-prev {
  animation: slideInLeft 0.25s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

/* PDF Canvas rendering */
.pdf-canvas {
  display: block;
  max-width: 100%;
  border-radius: 4px;
}

/* TEXT SELECTION LAYER */
.textLayer {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  opacity: 0.25;
  line-height: 1.0;
  border-radius: 4px;
}

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

/* Selection Color Tweaking */
.textLayer ::selection {
  background: rgba(99, 102, 241, 0.45) !important;
}

/* THEME FILTERS APPLIED TO CANVAS WRAPPER */
.pdf-page-wrapper.theme-light {
  filter: none;
  background-color: #ffffff;
}

.pdf-page-wrapper.theme-slate {
  filter: invert(0.9) hue-rotate(180deg) brightness(1.05) contrast(1.1);
  background-color: #ffffff;
}

.pdf-page-wrapper.theme-black {
  filter: invert(1) contrast(1.05);
  background-color: #ffffff;
}

.pdf-page-wrapper.theme-sepia {
  filter: sepia(0.65) contrast(0.95) brightness(1.02) hue-rotate(-10deg);
  background-color: #ffffff;
}

.pdf-page-wrapper.theme-mint {
  filter: sepia(0.4) hue-rotate(85deg) saturate(0.85) brightness(1.05);
  background-color: #ffffff;
}

/* Custom theme applies values updated via JS styles */
.pdf-page-wrapper.theme-custom {
  background-color: #ffffff;
  /* Filter variables updated dynamically by JS */
  filter: var(--custom-filter, none);
}

/* Active temporary bypass (hover or toggle click) */
.pdf-page-wrapper.bypass-theme {
  filter: none !important;
  background-color: #ffffff !important;
  box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
}

/* Slide-out Custom Theme Panel */
.custom-theme-panel {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  height: 100vh;
  z-index: 150;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
  border-left: 1px solid var(--panel-border);
}

.custom-theme-panel.open {
  transform: translateX(-320px);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 14px;
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.close-panel-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.close-panel-btn:hover {
  color: #fff;
}

.sliders-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.slider-label-val {
  color: #fff;
  font-weight: 600;
}

.custom-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.custom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-color);
  box-shadow: 0 0 5px var(--accent-glow);
  cursor: pointer;
  transition: all 0.2s ease;
}

.custom-slider::-webkit-slider-thumb:hover {
  background: #818cf8;
  transform: scale(1.2);
}

.reset-btn {
  margin-top: 10px;
  width: 100%;
  justify-content: center;
}


/* Bottom Controls / Footer */
.app-footer {
  height: var(--footer-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
  border-top: 1px solid var(--panel-border);
  position: relative;
  flex-shrink: 0;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-top-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  overflow: hidden;
}

.app-footer.hidden {
  height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  opacity: 0 !important;
  border-top-color: transparent !important;
  pointer-events: none;
}

/* Progress bar container (placed in flex flow between main-layout and footer) */
.timer-progress-container {
  height: 6px;
  background: rgba(0, 0, 0, 0.45); /* Solid dark contrast background */
  cursor: pointer;
  z-index: 120; /* Keep on top of other layouts */
  transition: height 0.2s ease, background-color 0.2s ease;
  width: 100%;
  flex-shrink: 0;
  position: relative;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.timer-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, #22c55e, #a855f7); /* Strong solid green to purple */
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.8), 0 0 12px rgba(34, 197, 94, 0.8);
  transition: width 0.05s linear;
}

.timer-progress-container:hover {
  height: 8px;
  background: rgba(0, 0, 0, 0.6);
}

.timer-progress-container:hover .timer-progress-bar {
  background: linear-gradient(to right, #4ade80, #c084fc); /* Highlight state */
  box-shadow: 0 0 16px rgba(192, 132, 252, 0.9), 0 0 16px rgba(74, 222, 128, 0.9);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 120px;
}

.page-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.page-input {
  width: 48px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  color: #fff;
  text-align: center;
  padding: 4px 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.page-input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 5px var(--accent-glow);
}

.footer-center {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  background: rgba(255,255,255,0.01);
  border-color: var(--panel-border);
}

.play-pause-btn {
  width: 44px;
  height: 44px;
  background: var(--accent-color);
  border: none;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  transition: all 0.2s ease;
  font-size: 1.1rem;
}

.play-pause-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
  transform: scale(1.1);
}

.play-pause-btn:active {
  transform: scale(1);
}

.play-pause-btn.playing {
  background: var(--success-color);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.play-pause-btn.playing:hover {
  background: #059669;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 120px;
  justify-content: flex-end;
}

.timer-config {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.timer-slider-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.timer-slider {
  -webkit-appearance: none;
  width: 100px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.timer-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  box-shadow: 0 0 5px var(--accent-glow);
  transition: all 0.2s ease;
}

.timer-slider::-webkit-slider-thumb:hover {
  background: #818cf8;
  transform: scale(1.2);
}

.timer-val {
  font-weight: 700;
  color: #fff;
  width: 32px;
  display: inline-block;
  text-align: right;
}

/* Animations */
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 0.7; }
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

/* Page transitions */
@keyframes slideOutLeft {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-100px); opacity: 0; }
}

@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100px); opacity: 0; }
}

@keyframes slideInRight {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInLeft {
  from { transform: translateX(-100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Loading Spinner */
.spinner-container {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  align-self: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Keyboard shortcuts overlay */
.keyboard-shortcuts-overlay {
  position: absolute;
  top: 80px;
  right: 24px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  z-index: 80;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.keyboard-shortcuts-overlay:hover {
  opacity: 1;
}

.shortcut-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.kbd-key {
  background: rgba(255,255,255,0.1);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.15);
  font-family: monospace;
  color: #fff;
}

.mobile-show {
  display: none !important;
}

/* ==========================================================================
   MOBILE DEVICES MEDIA QUERIES
   ========================================================================== */

@media (max-width: 768px) {
  :root {
    --header-height: 50px;
    --footer-height: 50px;
  }

  .mobile-show {
    display: inline-block !important;
  }

  .mobile-hide {
    display: none !important;
  }

  body {
    overflow: hidden;
  }

  /* Header adjustments */
  .app-header {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 0 12px;
    justify-content: space-between;
    height: var(--header-height);
  }

  .brand-section {
    gap: 6px;
  }

  .brand-text {
    display: none; /* Hide branding text, keep only logo to save space */
  }

  .logo-icon {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
    border-radius: 6px;
  }

  .file-name-display {
    display: none;
  }

  .controls-group {
    gap: 6px;
  }

  .zoom-controls {
    padding: 1px;
  }

  .zoom-btn {
    width: 28px;
    height: 28px;
  }

  #zoom-dropdown-container .dropdown-trigger {
    min-width: 50px;
    height: 28px;
    padding: 0 4px;
    font-size: 0.75rem;
  }

  .control-btn {
    padding: 6px 8px;
    font-size: 0.75rem;
    gap: 4px;
  }

  .control-btn svg {
    width: 14px;
    height: 14px;
  }

  /* Sidebar overlap behavior */
  .app-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 280px;
    z-index: 140;
    border-right: 1px solid var(--panel-border);
    transform: translateX(0);
    margin-left: 0;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.7);
  }

  .app-sidebar.collapsed {
    transform: translateX(-100%);
    margin-left: 0;
  }

  .sidebar-toggle-edge {
    left: 0;
    z-index: 145;
    width: 24px;
    height: 48px;
    border-radius: 0 4px 4px 0;
    background: rgba(20, 24, 33, 0.95);
  }

  /* Viewport spacing */
  .viewport-container {
    padding: 8px;
  }

  .welcome-screen {
    padding: 16px;
    gap: 12px;
  }

  .welcome-title {
    font-size: 1.3rem;
  }

  .welcome-desc {
    font-size: 0.85rem;
    line-height: 1.4;
  }

  .dropzone-area {
    padding: 16px;
  }

  /* Mobile styling for floating page turn buttons */
  .nav-edge-btn {
    width: 36px;
    height: 36px;
    background: rgba(20, 24, 33, 0.85);
  }

  .nav-edge-btn.left {
    left: 8px;
  }

  .nav-edge-btn.right {
    right: 8px;
  }

  /* Footer adjustments */
  .app-footer {
    flex-direction: row;
    padding: 0 12px;
    gap: 8px;
    height: var(--footer-height);
  }

  .footer-left, 
  .footer-right,
  .footer-center {
    min-width: unset;
    width: auto;
    justify-content: center;
  }

  .footer-left {
    justify-content: flex-start;
    flex: 1;
  }

  .footer-right {
    justify-content: flex-end;
    flex: 1;
  }

  .timer-config {
    width: auto;
    justify-content: flex-end;
    gap: 4px;
  }

  .timer-config span:first-child {
    display: none; /* Hide "Auto-turn:" label to save space */
  }

  .timer-slider-wrapper {
    gap: 6px;
  }

  .timer-slider {
    width: 55px; /* Ultra-compact slider */
  }

  .timer-val {
    font-size: 0.75rem;
    width: auto;
  }

  .page-counter {
    font-size: 0.75rem;
    gap: 4px;
  }

  .page-input {
    width: 36px;
    padding: 2px 0;
    font-size: 0.75rem;
  }

  .play-pause-btn {
    width: 32px;
    height: 32px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
  }

  .play-pause-btn svg {
    width: 14px;
    height: 14px;
  }

  .play-pause-btn.playing {
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  }

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

  .nav-btn svg {
    width: 14px;
    height: 14px;
  }

  /* Hide keyboard overlay on touch screens */
  .keyboard-shortcuts-overlay {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .brand-section {
    display: none; /* Hide logo completely on very small screens to keep controls in one line */
  }
  .app-header {
    justify-content: space-around;
    padding: 0 6px;
    gap: 4px;
  }
  .controls-group {
    gap: 4px;
  }
}

/* Floating Show Menu Button */
.floating-show-btn {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  animation: slideDownFade 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.floating-show-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateX(-50%) translateY(-1px);
  box-shadow: 0 0 15px var(--accent-glow);
  border-color: rgba(99, 102, 241, 0.4);
}

.floating-show-btn:active {
  transform: translateX(-50%) translateY(0);
}

@keyframes slideDownFade {
  from { transform: translateX(-50%) translateY(-20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
