@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400;1,700&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Manrope:wght@200..800&family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

/* CSS Custom Properties for Theming */
:root {
  /* Light Theme Colors */
  --primary-color: #123eef;
  --primary-light: rgba(18, 62, 239, 0.95);
  --primary-dark: #0f2fcc;
  --background-color: #ffffff;
  --surface-color: #f8fafc;
  --surface-elevated: #ffffff;
  --card-bg: rgba(255, 255, 255, 0.8);
  --input-bg: rgba(248, 250, 252, 0.8);
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-inverse: #ffffff;
  --border-color: rgba(148, 163, 184, 0.3);
  --border-light: rgba(148, 163, 184, 0.2);
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-medium: rgba(0, 0, 0, 0.15);
  --shadow-dark: rgba(0, 0, 0, 0.25);
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-bg-elevated: rgba(255, 255, 255, 0.25);
  --backdrop-blur: 10px;
  
  /* Interactive States */
  --hover-overlay: rgba(148, 163, 184, 0.1);
  --active-overlay: rgba(148, 163, 184, 0.2);
  --focus-ring: rgba(18, 62, 239, 0.3);
  
  /* Loading & Progress */
  --skeleton-base: #e2e8f0;
  --skeleton-highlight: #f1f5f9;
  --progress-bg: rgba(255, 255, 255, 0.2);
  --progress-fill: #ffffff;
  
  /* Modal and overlay */
  --modal-overlay: rgba(0, 0, 0, 0.75);
  
  /* Button colors */
  --button-secondary-bg: rgba(148, 163, 184, 0.1);
  --button-secondary-hover-bg: rgba(148, 163, 184, 0.2);
  
  /* Gradients */
  --primary-gradient: linear-gradient(135deg, #123eef, #0f2fcc);
  --primary-gradient-hover: linear-gradient(135deg, #0f2fcc, #0a1f99);
  
  /* Status colors */
  --info-bg: rgba(59, 130, 246, 0.1);
  --info-border: rgba(59, 130, 246, 0.3);
  --info-text: #1d4ed8;
  --error-bg: rgba(239, 68, 68, 0.1);
  --error-border: rgba(239, 68, 68, 0.3);
  --error-text: #dc2626;
  --error-color: #dc2626;
  --error-hover: #b91c1c;
  --error-hover-bg: rgba(239, 68, 68, 0.2);
  --success-bg: rgba(34, 197, 94, 0.1);
  --success-border: rgba(34, 197, 94, 0.3);
  --success-text: #16a34a;
  --success-color: #16a34a;
  --success-hover: #15803d;
  
  /* Shadows */
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-primary: 0 8px 25px rgba(18, 62, 239, 0.3);
}

/* Dark Theme */
[data-theme="dark"] {
  --primary-color: #3b82f6;
  --primary-light: rgba(59, 130, 246, 0.95);
  --primary-dark: #2563eb;
  --background-color: #0f172a;
  --surface-color: #1e293b;
  --surface-elevated: #334155;
  --card-bg: rgba(51, 65, 85, 0.8);
  --input-bg: rgba(30, 41, 59, 0.8);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-inverse: #0f172a;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.05);
  --shadow-light: rgba(0, 0, 0, 0.3);
  --shadow-medium: rgba(0, 0, 0, 0.4);
  --shadow-dark: rgba(0, 0, 0, 0.6);
  --glass-bg: rgba(0, 0, 0, 0.15);
  --glass-bg-elevated: rgba(0, 0, 0, 0.25);
  
  /* Interactive States */
  --hover-overlay: rgba(255, 255, 255, 0.05);
  --active-overlay: rgba(255, 255, 255, 0.1);
  --focus-ring: rgba(59, 130, 246, 0.3);
  
  /* Loading & Progress */
  --skeleton-base: #334155;
  --skeleton-highlight: #475569;
  --progress-bg: rgba(0, 0, 0, 0.2);
  --progress-fill: #3b82f6;
  
  /* Modal and overlay */
  --modal-overlay: rgba(0, 0, 0, 0.85);
  
  /* Button colors */
  --button-secondary-bg: rgba(71, 85, 105, 0.2);
  --button-secondary-hover-bg: rgba(71, 85, 105, 0.3);
  
  /* Gradients */
  --primary-gradient: linear-gradient(135deg, #3b82f6, #2563eb);
  --primary-gradient-hover: linear-gradient(135deg, #2563eb, #1d4ed8);
  
  /* Status colors */
  --info-bg: rgba(59, 130, 246, 0.1);
  --info-border: rgba(59, 130, 246, 0.3);
  --info-text: #60a5fa;
  --error-bg: rgba(239, 68, 68, 0.1);
  --error-border: rgba(239, 68, 68, 0.3);
  --error-text: #f87171;
  --error-color: #ef4444;
  --error-hover: #dc2626;
  --error-hover-bg: rgba(239, 68, 68, 0.2);
  --success-bg: rgba(34, 197, 94, 0.1);
  --success-border: rgba(34, 197, 94, 0.3);
  --success-text: #4ade80;
  --success-color: #22c55e;
  --success-hover: #16a34a;
  
  /* Shadows */
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-primary: 0 8px 25px rgba(59, 130, 246, 0.4);
}

/* Accessibility Styles */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #123eef;
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 0 0 4px 4px;
  z-index: 10000;
  font-weight: bold;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus indicators for accessibility */
button:focus,
input:focus,
[role="button"]:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .control-btn,
  .nav-btn {
    border: 2px solid white;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .flipbook {
    transition: none !important;
  }
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--primary-color);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Main container */
.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  background: var(--background-color);
  position: relative;
  transition: background-color 0.3s ease;
  padding: 15px;
  gap: 15px;
}

/* Header */
.header {
  font-family: 'Manrope', sans-serif;
  background: var(--primary-light);
  backdrop-filter: blur(var(--backdrop-blur));
  color: var(--text-inverse);
  padding: 25px;
  border-radius: 16px;
  z-index: 100;
  box-shadow: 
    0 10px 40px var(--shadow-medium),
    0 1px 3px var(--shadow-light),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  position: relative;
}

.header-top {
  text-align: center;
  margin-bottom: 20px;
}

.header-title-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  position: relative;
}

.header h1 {
  font-size: 2.2em;
  font-weight: 700;
  margin: 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  background: linear-gradient(45deg, #ffffff, #e8f4fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Theme Toggle */
.theme-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  color: var(--text-inverse);
}

.theme-toggle:hover {
  background: var(--glass-bg-elevated);
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 4px 20px var(--shadow-light);
}

.theme-toggle:active {
  transform: translateY(-50%) scale(0.95);
}

.theme-icon {
  transition: all 0.3s ease;
  position: absolute;
}

.moon-icon {
  opacity: 0;
  transform: rotate(90deg);
}

[data-theme="dark"] .sun-icon {
  opacity: 0;
  transform: rotate(-90deg);
}

[data-theme="dark"] .moon-icon {
  opacity: 1;
  transform: rotate(0deg);
}

/* Skeleton Loading Animations */
@keyframes skeleton-loading {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--skeleton-base) 25%,
    var(--skeleton-highlight) 50%,
    var(--skeleton-base) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 8px;
}

.skeleton-text {
  height: 16px;
  margin: 8px 0;
}

.skeleton-text.large {
  height: 24px;
}

.skeleton-text.small {
  height: 12px;
  width: 60%;
}

.skeleton-button {
  height: 40px;
  width: 120px;
  border-radius: 20px;
}

.skeleton-card {
  padding: 20px;
  background: var(--surface-elevated);
  border-radius: 12px;
  margin: 10px 0;
  box-shadow: 0 2px 8px var(--shadow-light);
}

/* Enhanced Loading States */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  background: var(--surface-color);
  border-radius: 12px;
  margin: 20px;
  box-shadow: 0 4px 20px var(--shadow-light);
}

/* Welcome State */
.welcome-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}

.welcome-icon {
  color: var(--primary-color);
  margin-bottom: 24px;
  opacity: 0.8;
  animation: welcomeFloat 3s ease-in-out infinite;
}

@keyframes welcomeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.welcome-text {
  font-size: 1.8em;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtext {
  font-size: 1.1em;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.6;
}

.welcome-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 300px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--glass-bg);
  border-radius: 12px;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 0.95em;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.feature-item:hover {
  background: var(--glass-bg-elevated);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-light);
}

.feature-item svg {
  color: var(--primary-color);
  flex-shrink: 0;
}

/* Processing State */
.processing-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Mobile responsiveness for welcome state */
@media (max-width: 768px) {
  .welcome-state {
    max-width: 100%;
    padding: 0 10px;
  }
  
  .welcome-icon {
    margin-bottom: 20px;
  }
  
  .welcome-icon svg {
    width: 60px;
    height: 60px;
  }
  
  .welcome-text {
    font-size: 1.5em;
    margin-bottom: 10px;
  }
  
  .welcome-subtext {
    font-size: 1em;
    margin-bottom: 24px;
  }
  
  .welcome-features {
    max-width: 280px;
    gap: 12px;
  }
  
  .feature-item {
    padding: 10px 14px;
    font-size: 0.9em;
  }
  
  .feature-item svg {
    width: 14px;
    height: 14px;
  }
}

@media (max-width: 480px) {
  .loading-container {
    padding: 30px 15px;
    margin: 15px;
  }
  
  .welcome-text {
    font-size: 1.3em;
  }
  
  .welcome-features {
    max-width: 260px;
  }
}

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

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

.loading-text {
  color: var(--text-secondary);
  font-size: 1.1em;
  margin-bottom: 10px;
}

.loading-subtext {
  color: var(--text-secondary);
  font-size: 0.9em;
  opacity: 0.7;
}

/* Progress Indicators */
.progress-container {
  width: 100%;
  max-width: 400px;
  margin: 20px 0;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--progress-bg);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
  border-radius: 4px;
  transition: width 0.3s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-text {
  text-align: center;
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 0.9em;
}

/* Upload Progress */
.upload-progress {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface-elevated);
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 10px 40px var(--shadow-dark);
  z-index: 1000;
  min-width: 300px;
  border: 1px solid var(--border-light);
}

.upload-progress.show {
  display: block;
  animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.controls-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 0 20px;
}

.controls-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 10px;
}

.viewer-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* File upload section enhancement */
.file-upload-section {
  position: relative;
}

.file-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.file-label {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: var(--text-inverse);
  padding: 12px 24px;
  border-radius: 30px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.5px;
  box-shadow: 
    0 4px 15px var(--shadow-medium),
    0 1px 3px var(--shadow-light);
  border: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.file-label:hover {
  transform: translateY(-3px);
  box-shadow: 
    0 8px 25px var(--shadow-dark),
    0 2px 8px var(--shadow-medium);
}

.file-label:active {
  transform: translateY(-1px);
}

/* Enhanced Button Styles */
.control-btn,
.file-label {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  color: var(--text-inverse);
  padding: 10px 16px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(var(--backdrop-blur));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow-light);
}

.control-btn:hover,
.file-label:hover {
  background: var(--glass-bg-elevated);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--shadow-medium);
  border-color: var(--border-color);
}

.control-btn:active,
.file-label:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px var(--shadow-light);
}

.control-btn:focus,
.file-label:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Button hover effect */
.control-btn::before,
.file-label::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    var(--hover-overlay),
    transparent
  );
  transition: left 0.5s ease;
}

.control-btn:hover::before,
.file-label:hover::before {
  left: 100%;
}

/* SVG icon styles */
.control-btn svg {
  transition: transform 0.3s ease;
}

.control-btn:hover svg {
  transform: scale(1.1);
}

/* Audio button state handling */
.control-btn[aria-pressed="false"] .audio-icon-on {
  display: none;
}

.control-btn[aria-pressed="false"] .audio-icon-off {
  display: block;
}

/* Search Controls */
.search-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.search-input-wrapper:focus-within {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.search-input {
  background: transparent;
  border: none;
  color: white;
  padding: 6px 12px;
  font-size: 0.85em;
  outline: none;
  width: 200px;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.search-btn {
  background: none;
  border: none;
  color: white;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 15px;
  transition: all 0.3s ease;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
}

.search-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.search-btn.clear-btn {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8em;
}

.search-navigation {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 15px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.search-nav-btn {
  background: none;
  border: none;
  color: white;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.3s ease;
  font-size: 0.8em;
  min-width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

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

.search-results {
  color: white;
  font-size: 0.75em;
  font-weight: 600;
  min-width: 40px;
  text-align: center;
  margin: 0 4px;
}

.file-input {
  display: none;
}

.file-label {
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
  white-space: nowrap;
}

.file-label:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.control-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 8px 14px;
  border-radius: 15px;
  cursor: pointer;
  font-size: 0.85em;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.control-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.control-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modern Volume Slider Control */
.volume-control {
  display: flex;
  align-items: center;
  gap: 5px;
}

.volume-slider-container {
  position: relative;
  width: 70px;
  height: 20px;
  display: flex;
  align-items: center;
}

.volume-slider {
  position: absolute;
  width: 100%;
  height: 6px;
  background: transparent;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  z-index: 3;
  border-radius: 3px;
}

.slider-track {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.2),
    rgba(255, 255, 255, 0.3)
  );
  border-radius: 3px;
  transform: translateY(-50%);
  box-shadow: 
    inset 0 1px 2px rgba(0, 0, 0, 0.3),
    0 1px 1px rgba(255, 255, 255, 0.2);
  z-index: 1;
}

.slider-fill {
  position: absolute;
  top: 50%;
  left: 0;
  width: 30%;
  height: 6px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0.7),
    rgba(200, 220, 255, 0.8)
  );
  border-radius: 3px;
  transform: translateY(-50%);
  transition: width 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 
    0 0 8px rgba(255, 255, 255, 0.4),
    0 1px 2px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 1),
    rgba(240, 240, 240, 0.95),
    rgba(220, 220, 220, 0.9)
  );
  border: 2px solid rgba(255, 255, 255, 0.8);
  cursor: pointer;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.6),
    inset 0 -1px 1px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  position: relative;
  z-index: 4;
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 1),
    rgba(240, 240, 240, 0.95),
    rgba(220, 220, 220, 0.9)
  );
  border: 2px solid rgba(255, 255, 255, 0.8);
  cursor: pointer;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.6),
    inset 0 -1px 1px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.volume-slider:hover::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 
    0 3px 12px rgba(0, 0, 0, 0.4),
    0 0 0 3px rgba(255, 255, 255, 0.3),
    inset 0 1px 3px rgba(255, 255, 255, 0.7),
    inset 0 -1px 2px rgba(0, 0, 0, 0.1);
}

.volume-slider:hover::-moz-range-thumb {
  transform: scale(1.15);
  box-shadow: 
    0 3px 12px rgba(0, 0, 0, 0.4),
    0 0 0 3px rgba(255, 255, 255, 0.3),
    inset 0 1px 3px rgba(255, 255, 255, 0.7),
    inset 0 -1px 2px rgba(0, 0, 0, 0.1);
}

.volume-slider:active::-webkit-slider-thumb {
  transform: scale(0.9);
  box-shadow: 
    0 1px 4px rgba(0, 0, 0, 0.4),
    inset 0 1px 1px rgba(0, 0, 0, 0.2);
}

.volume-slider:active::-moz-range-thumb {
  transform: scale(0.9);
  box-shadow: 
    0 1px 4px rgba(0, 0, 0, 0.4),
    inset 0 1px 1px rgba(0, 0, 0, 0.2);
}

.volume-slider:hover + .slider-track {
  box-shadow: 
    inset 0 1px 3px rgba(0, 0, 0, 0.4),
    0 1px 2px rgba(255, 255, 255, 0.3);
}

.volume-slider:hover ~ .slider-fill {
  box-shadow: 
    0 0 12px rgba(255, 255, 255, 0.6),
    0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Firefox specific styling */
.volume-slider::-moz-range-track {
  background: transparent;
  border: none;
}

/* Zoom info display */
.zoom-info {
  background: var(--surface-elevated);
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 0.8em;
  color: var(--text-primary);
  font-weight: 600;
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
}

/* Viewer container */
.viewer-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 25px;
  background: var(--surface-color);
  overflow: hidden;
  position: relative;
  border-radius: 16px;
  box-shadow: 
    inset 0 1px 3px var(--shadow-light),
    0 1px 3px var(--shadow-light);
  border: 1px solid var(--border-light);
  transition: background-color 0.3s ease;
}

/* Loading styles */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  height: 100%;
  color: #666;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Enhanced flipbook container with zoom support */
.flipbook-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.flipbook-wrapper.dragging {
  cursor: grabbing;
}

.flipbook-wrapper.zoomed {
  cursor: move;
}

.flipbook {
  margin: 0 auto;
  box-shadow: 
    0 20px 60px var(--shadow-dark),
    0 8px 25px var(--shadow-medium),
    0 2px 8px var(--shadow-light);
  border-radius: 12px;
  overflow: visible;
  transform-origin: center center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  border: 1px solid var(--border-light);
}

.flipbook.smooth-zoom {
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.flipbook .page {
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.flipbook .page canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
  border-radius: 4px;
}

/* Enhanced page shadows for better depth */
.flipbook .page {
  -webkit-box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  -moz-box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  -ms-box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  -o-box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

/* Turn.js page peel corner effects */
.flipbook .turn-page {
  -webkit-box-shadow: 0 0 20px rgba(0,0,0,0.5);
  -moz-box-shadow: 0 0 20px rgba(0,0,0,0.5);
  -ms-box-shadow: 0 0 20px rgba(0,0,0,0.5);
  -o-box-shadow: 0 0 20px rgba(0,0,0,0.5);
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* Corner hover cursor */
.flipbook .turn-page-corner {
  cursor: pointer;
}

/* Enhanced gradients for page turning effect */
.flipbook .even .gradient {
  background: -webkit-gradient(linear, left top, right top, color-stop(0.95, rgba(0,0,0,0)), color-stop(1, rgba(0,0,0,0.2)));
}

.flipbook .odd .gradient {
  background: -webkit-gradient(linear, right top, left top, color-stop(0.95, rgba(0,0,0,0)), color-stop(1, rgba(0,0,0,0.15)));
}


/* Navigation */
.navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 18px 24px;
  background: var(--surface-elevated);
  border-radius: 30px;
  margin-top: 20px;
  backdrop-filter: blur(15px);
  box-shadow: 
    0 8px 32px var(--shadow-medium),
    0 2px 8px var(--shadow-light),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
}

.nav-btn {
  background: var(--primary-color);
  color: var(--text-inverse);
  border: 1px solid var(--border-color);
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  font-size: 0.9em;
  box-shadow: 0 2px 8px var(--shadow-light);
}

.nav-btn:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow-medium);
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--text-secondary);
}

.page-info {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1em;
  min-width: 120px;
  text-align: center;
  transition: color 0.3s ease;
}

/* Fullscreen styles */
.viewer-container.fullscreen {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999;
  background: #000;
  padding: 20px;
}

/* Zoom controls overlay */
.zoom-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.95);
  padding: 10px;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  pointer-events: auto;
  touch-action: manipulation;
}

.zoom-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: linear-gradient(45deg, var(--primary-color), var(--primary-dark));
  color: var(--text-inverse);
  font-size: 1.2em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 8px var(--shadow-light);
}

.zoom-btn:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 4px 15px var(--shadow-medium);
}

.zoom-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--text-secondary);
}

.zoom-reset {
  background: linear-gradient(45deg, #28a745, #20c997);
  font-size: 0.7em;
  font-weight: 600;
}

/* Responsive design */
/* Extra small devices (phones, 480px and down) */
@media (max-width: 480px) {
  .header {
    padding: 12px;
    margin-bottom: 12px;
  }

  .header-top {
    margin-bottom: 12px;
  }

  .header h1 {
    font-size: 1.5em;
  }

  .controls {
    gap: 10px;
  }

  .controls-primary {
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .controls-secondary {
    gap: 8px;
    justify-content: center;
  }

  .viewer-controls {
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .control-btn,
  .file-label {
    padding: 5px 8px;
    font-size: 0.75em;
    border-radius: 12px;
  }

  .zoom-info {
    font-size: 0.7em;
    padding: 3px 6px;
  }

  .volume-control {
    display: none !important;
  }

  .viewer-container {
    padding: 5px;
  }

  .navigation {
    gap: 8px;
    padding: 8px;
    margin-top: 8px;
    border-radius: 20px;
    position: fixed;
    bottom: 10px;
    left: 10px;
    right: 10px;
    z-index: 150;
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.98);
  }

  .nav-btn {
    padding: 8px 12px;
    font-size: 0.8em;
    border-radius: 15px;
    flex: 1;
    max-width: 100px;
  }

  .page-info {
    font-size: 0.85em;
    min-width: 80px;
  }

  .zoom-controls {
    top: 5px;
    right: 5px;
    padding: 6px;
    gap: 6px;
    z-index: 99999;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  }

  .zoom-btn {
    width: 36px;
    height: 36px;
    font-size: 1em;
    min-width: 36px;
    min-height: 36px;
  }

  .flipbook {
    max-height: calc(100vh - 140px);
  }
}

/* Small devices (phones, 481px to 600px) */
@media (min-width: 481px) and (max-width: 600px) {
  .header {
    padding: 8px 12px;
    min-height: 50px;
  }

  .header h1 {
    font-size: 1.05em;
  }

  .controls {
    gap: 6px;
  }

  .control-btn,
  .file-label {
    padding: 6px 10px;
    font-size: 0.78em;
  }

  .volume-control {
    display: none !important;
  }

  .viewer-container {
    padding: 8px;
  }

  .navigation {
    gap: 10px;
    padding: 10px;
    margin-top: 10px;
    position: fixed;
    bottom: 15px;
    left: 15px;
    right: 15px;
    z-index: 150;
    backdrop-filter: blur(15px);
  }

  .nav-btn {
    padding: 8px 14px;
    font-size: 0.82em;
  }

  .zoom-controls {
    top: 8px;
    right: 8px;
    padding: 6px;
    z-index: 99999;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  }

  .zoom-btn {
    width: 34px;
    height: 34px;
    font-size: 1em;
    min-width: 34px;
    min-height: 34px;
  }
}

/* Medium devices (tablets, 601px to 768px) */
@media (min-width: 601px) and (max-width: 768px) {
  .header {
    padding: 15px;
    margin-bottom: 15px;
  }

  .header-top {
    margin-bottom: 15px;
  }

  .header h1 {
    font-size: 1.8em;
  }

  .controls {
    gap: 12px;
  }

  .controls-primary,
  .controls-secondary {
    gap: 10px;
  }

  .viewer-controls {
    gap: 8px;
  }

  .control-btn,
  .file-label {
    padding: 6px 12px;
    font-size: 0.8em;
  }

  .viewer-container {
    padding: 10px;
  }

  .navigation {
    gap: 12px;
    padding: 12px;
    margin-top: 12px;
    position: relative;
  }

  .nav-btn {
    padding: 8px 16px;
    font-size: 0.85em;
  }

  .zoom-controls {
    top: 10px;
    right: 10px;
    padding: 6px;
  }

  .zoom-btn {
    width: 35px;
    height: 35px;
    font-size: 1em;
  }

  /* Enhanced volume slider for medium screens */
  .volume-slider-container {
    width: 80px;
  }

  .volume-slider::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
  }

  .volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
  }

  .slider-track,
  .slider-fill {
    height: 7px;
  }
}

/* Legacy mobile breakpoint for devices above 768px */
@media (min-width: 769px) and (max-width: 1024px) {
  .header {
    padding: 10px 20px;
    min-height: 60px;
  }

  .navigation {
    position: relative;
    margin-top: 15px;
  }
}

/* Slideshow Modal */
.slideshow-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(5px);
}

.slideshow-modal-content {
  background: white;
  border-radius: 15px;
  padding: 0;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease-out;
}

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

.slideshow-modal-header {
  background: #123eef;
  color: white;
  padding: 15px 20px;
  border-radius: 15px 15px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slideshow-modal-header h3 {
  margin: 0;
  font-size: 1.2em;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.5em;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.3s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.slideshow-modal-body {
  padding: 20px;
}

.slideshow-setting {
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slideshow-setting label {
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  transition: color 0.3s ease;
}

.slideshow-setting input[type="number"] {
  width: 80px;
  padding: 8px;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  font-size: 1em;
  text-align: center;
  background: var(--surface-elevated);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.slideshow-setting input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary-color);
}

.slideshow-modal-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.slideshow-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9em;
}

.start-btn {
  background: var(--primary-color);
  color: var(--text-inverse);
}

.start-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.cancel-btn {
  background: var(--surface-color);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.cancel-btn:hover {
  background: var(--surface-elevated);
  color: var(--text-primary);
}

/* Slideshow Controls Overlay */
.slideshow-controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 25px;
  padding: 15px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 1000;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  min-width: 250px;
}

.slideshow-progress {
  width: 100%;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}

.slideshow-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #123eef, #667eea);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

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

.slideshow-control-btn {
  background: #123eef;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 15px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85em;
  transition: all 0.3s ease;
}

.slideshow-control-btn:hover {
  background: #0f35d1;
  transform: translateY(-1px);
}

.slideshow-timer {
  font-weight: 600;
  color: #333;
  font-size: 0.9em;
  min-width: 40px;
  text-align: center;
}

/* Slideshow active state */
.slideshow-active .control-btn:not(#stopSlideshow) {
  opacity: 0.5;
  pointer-events: none;
}

.slideshow-active .navigation {
  opacity: 0.7;
  pointer-events: none;
}

/* Mobile slideshow adjustments */
@media (max-width: 480px) {
  .slideshow-modal-content {
    width: 95%;
    margin: 10px;
  }
  
  .slideshow-controls {
    bottom: 80px;
    left: 10px;
    right: 10px;
    transform: none;
    min-width: auto;
  }
  
  .slideshow-control-btn {
    padding: 6px 12px;
    font-size: 0.8em;
  }
  
  .slideshow-setting {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .slideshow-setting input[type="number"] {
    width: 100%;
  }
}

@media (min-width: 481px) and (max-width: 600px) {
  .slideshow-controls {
    bottom: 85px;
  }
}

/* Message Modal */
.message-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15000;
  backdrop-filter: blur(5px);
}

.message-modal-content {
  background: white;
  border-radius: 15px;
  padding: 0;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: messageSlideUp 0.3s ease-out;
}

@keyframes messageSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.message-modal-header {
  background: #123eef;
  color: white;
  padding: 15px 20px;
  border-radius: 15px 15px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.message-modal-icon {
  font-size: 1.2em;
  min-width: 24px;
}

.message-modal-header h3 {
  margin: 0;
  font-size: 1.1em;
  font-weight: 600;
  flex: 1;
}

.message-modal-body {
  padding: 20px;
}

.message-modal-body p {
  margin: 0;
  font-size: 1em;
  line-height: 1.5;
  color: #333;
}

.message-modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
}

.message-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9em;
}

.ok-btn {
  background: #123eef;
  color: white;
}

.ok-btn:hover {
  background: #0f35d1;
  transform: translateY(-1px);
}

/* Message modal variants */
.message-modal.error .message-modal-header {
  background: #dc2626;
}

.message-modal.warning .message-modal-header {
  background: #f59e0b;
}

.message-modal.success .message-modal-header {
  background: #059669;
}

/* Mobile message modal adjustments */
@media (max-width: 480px) {
  .message-modal-content {
    width: 95%;
    margin: 10px;
  }
  
  .message-modal-header {
    padding: 12px 15px;
  }
  
  .message-modal-header h3 {
    font-size: 1em;
  }
  
  .message-modal-body {
    padding: 15px;
  }
  
  .message-modal-footer {
    padding: 12px 15px;
  }
  
  .message-btn {
    padding: 8px 16px;
    font-size: 0.85em;
  }
}

/* PWA Styles */
.install-btn {
  background: linear-gradient(45deg, #28a745, #20c997) !important;
  position: relative;
  overflow: hidden;
}

.install-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s;
}

.install-btn:hover::before {
  left: 100%;
}

.pulse-animation {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
  100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

/* PWA Modal Styles */
.pwa-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.pwa-modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

.pwa-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e9ecef;
  background: linear-gradient(135deg, #123eef, #667eea);
  color: var(--text-inverse);
  border-radius: 12px 12px 0 0;
}

.pwa-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.pwa-modal-close {
  background: none;
  border: none;
  color: var(--text-inverse);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.pwa-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.pwa-modal-body {
  padding: 24px;
  color: #333;
  line-height: 1.6;
}

.pwa-modal-body h3 {
  color: #123eef;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-modal-body ol {
  margin: 16px 0;
  padding-left: 20px;
}

.pwa-modal-body li {
  margin-bottom: 8px;
}

.pwa-modal-body ul {
  list-style: none;
  padding-left: 0;
}

.pwa-modal-body ul li {
  padding: 4px 0;
}

.pwa-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e9ecef;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.pwa-btn-secondary {
  background: #6c757d;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease;
}

.pwa-btn-secondary:hover {
  background: #5a6268;
}

/* Update Notification */
.update-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  animation: slideInRight 0.3s ease;
  max-width: 320px;
}

.update-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.update-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

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

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* PWA Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

/* PWA Responsive Styles */
@media (max-width: 768px) {
  .pwa-modal-content {
    width: 95%;
    margin: 20px;
  }
  
  .pwa-modal-header {
    padding: 16px 20px;
  }
  
  .pwa-modal-body {
    padding: 20px;
  }
  
  .update-notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }
  
  .update-content {
    justify-content: space-between;
  }
  
  .install-btn {
    font-size: 0.8em;
    padding: 6px 10px;
  }
}

/* Hide scrollbars */
.flipbook-wrapper::-webkit-scrollbar {
  display: none;
}
.flipbook-wrapper {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Reel Maker Styles */
.reel-maker-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.reel-maker-modal-content {
  background: var(--card-bg);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.reel-maker-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.reel-maker-modal-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
}

.reel-maker-modal-body {
  padding: 24px;
}

.reel-maker-section {
  margin-bottom: 32px;
}

.reel-maker-section h4 {
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.reel-setting {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.reel-setting label {
  color: var(--text-secondary);
  font-weight: 500;
  min-width: 140px;
  font-size: 0.95rem;
}

.reel-setting input[type="number"],
.reel-setting input[type="text"],
.reel-setting select {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.95rem;
  min-width: 120px;
}

.reel-setting input[type="number"]:focus,
.reel-setting input[type="text"]:focus,
.reel-setting select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.reel-setting input[type="range"] {
  flex: 1;
  max-width: 150px;
}

.reel-setting input[type="checkbox"],
.reel-setting input[type="radio"] {
  margin-right: 8px;
}

.page-selector-container {
  display: flex;
  flex-direction: column;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-top: 8px;
  width: 100%;
  max-height: 400px;
  position: relative;
  isolation: isolate;
  user-select: none;
}

.page-selector-container.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.page-selector-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.page-selector-btn {
  background: var(--primary-color);
  color: var(--text-inverse);
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.page-selector-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.selected-count {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  margin-left: auto;
}

.page-selector-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.page-search {
  display: flex;
  gap: 8px;
  align-items: center;
}

.page-search input {
  flex: 1;
  background: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.9rem;
  position: relative;
  isolation: isolate;
}

.page-search input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.add-range-btn {
  background: var(--success-color);
  color: var(--text-inverse);
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.add-range-btn:hover {
  background: var(--success-hover);
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 6px;
  max-height: 250px;
  overflow-y: auto;
  padding: 8px;
  background: var(--background-color);
  border-radius: 8px;
  border: 1px solid var(--border-light);
  position: relative;
  isolation: isolate;
  contain: layout style;
}

.page-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 40px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  background: var(--input-bg);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  user-select: none;
}

.page-item:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
  transform: translateY(-1px);
}

.page-item.selected {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--text-inverse);
  box-shadow: 0 2px 4px var(--shadow-light);
}

.page-item.out-of-range {
  opacity: 0.3;
  cursor: not-allowed;
  background: var(--error-light);
  border-color: var(--error-color);
}

.page-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

.page-nav-btn {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.page-nav-btn:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary-color);
}

.page-nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.music-setting {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.music-file-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.music-file-button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: var(--text-inverse);
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  font-size: 0.95rem;
  font-weight: 500;
  min-height: 48px;
  justify-content: center;
  text-align: center;
}

.music-file-button:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.music-file-icon {
  font-size: 1.2rem;
}

.music-file-text {
  font-weight: 600;
}

.music-file-formats {
  font-size: 0.8rem;
  opacity: 0.8;
  font-weight: 400;
}

.file-input-hidden {
  display: none;
}

.music-file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--success-bg);
  border: 2px solid var(--success-border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--success-text);
  font-size: 0.9rem;
  animation: slideIn 0.3s ease;
}

.music-file-name-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.music-file-icon-small {
  font-size: 1rem;
  flex-shrink: 0;
}

#musicFileName {
  font-weight: 500;
  color: var(--success-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clear-music-btn {
  background: var(--error-color);
  color: var(--text-inverse);
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.clear-music-btn:hover {
  background: var(--error-hover);
  transform: scale(1.05);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Quality Information Panel */
.quality-info-panel {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.quality-info-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--primary-color);
  font-size: 14px;
}

.quality-info-header svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.quality-info-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quality-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.quality-info-label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.quality-info-value {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

/* Quality panel animations */
.quality-info-panel.updating {
  transform: scale(0.98);
  opacity: 0.7;
}

.quality-info-panel.updated {
  transform: scale(1.02);
  animation: qualityPulse 0.4s ease-out;
}

@keyframes qualityPulse {
  0% { transform: scale(1.02); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.reel-maker-modal-footer {
  display: flex;
  justify-content: space-between;
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
}

.reel-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.generate-btn {
  background: var(--primary-gradient);
  color: var(--text-inverse);
}

.generate-btn:hover {
  background: var(--primary-gradient-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-primary);
}

.cancel-btn {
  background: var(--button-secondary-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.cancel-btn:hover {
  background: var(--button-secondary-hover-bg);
  color: var(--text-primary);
}

/* Reel Progress Modal */
.reel-progress-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.reel-progress-modal-content {
  background: var(--card-bg);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.reel-progress-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.reel-progress-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.4rem;
  font-weight: 600;
}

.reel-progress-body {
  padding: 32px 24px;
}

.progress-container {
  margin-bottom: 24px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  text-align: center;
  color: #e2e8f0;
  font-weight: 500;
  font-size: 1.1rem;
}

.progress-details {
  margin-top: 24px;
}

.progress-step {
  padding: 8px 0;
  color: #94a3b8;
  font-size: 0.95rem;
  transition: color 0.3s ease;
}

.progress-step.active {
  color: #60a5fa;
  font-weight: 500;
}

.progress-step.completed {
  color: #34d399;
}

.reel-progress-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .reel-maker-modal-content {
    width: 95%;
    margin: 10px;
  }
  
  .reel-setting {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .reel-setting label {
    min-width: auto;
  }
  
  .reel-maker-modal-footer {
    flex-direction: column;
    gap: 12px;
  }
  
  /* Mobile responsive quality info */
  .quality-info-panel {
    padding: 12px;
    margin-top: 12px;
  }
  
  .quality-info-header {
    font-size: 13px;
    margin-bottom: 10px;
  }
  
  .quality-info-row {
    padding: 3px 0;
  }
  
  .quality-info-label,
  .quality-info-value {
    font-size: 12px;
  }
  
  .quality-info-value {
    max-width: 55%;
  }
  
  .reel-btn {
    width: 100%;
  }
  
  .music-file-button {
    flex-direction: column;
    gap: 4px;
    min-height: 60px;
    text-align: center;
  }
  
  .music-file-formats {
    font-size: 0.75rem;
  }
  
  .music-file-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .clear-music-btn {
    align-self: flex-end;
  }
}
