:root {
  --primary-color: #4888d0;
  --secondary-color: #333;
  --background-color: #f6fafa;
  --text-color: #222;
  --border-color: #ddd;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

h1 {
  text-align: center;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.description {
  text-align: center;
  margin-bottom: 2rem;
}

/* PDF Flipbook container styling */
.pdf-container {
  width: 100%;
  height: 70vh; /* 70% of viewport height */
  margin: 0 auto 2rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  background-color: #fff;
  position: relative;
  transition: all 0.3s ease;
}

/* Fullscreen mode */
.pdf-container.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  border-radius: 0;
  border: none;
}

/* Turn.js flipbook */
#flipbook {
  width: 100%;
  height: 100%;
}

/* Page styling */
.page {
  background-color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* Canvas inside pages */
.page canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Page number */
.page-number {
  position: absolute;
  bottom: 10px;
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  color: #888;
}

/* Loading and error messages */
.loading-message, .error-message {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  text-align: center;
  padding: 2rem;
}

.error-message {
  color: #d32f2f;
  font-weight: bold;
}

/* Upload section styling */
.upload-container {
  background-color: white;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.upload-container h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: var(--primary-color);
}

input[type="file"] {
  margin-bottom: 1rem;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  width: 100%;
}

/* Controls styling */
.controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
}

button:hover {
  background-color: #3a6eb0;
}

button:active {
  transform: translateY(1px);
}

/* Hard cover effect for the first and last pages */
#flipbook .hard {
  background: #4888d0;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: linear-gradient(90deg, #3a6eb0 0%, #4888d0 20%, #4888d0 80%, #3a6eb0 100%);
  box-shadow: inset 0 0 5px #333;
}

/* Cover title */
.cover-title {
  font-size: 2rem;
  font-weight: bold;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  padding: 1rem;
}

/* When in double display, double pages should be twice as wide */
#flipbook .double {
  width: 200%;
}

/* Shadow effect when flipping pages */
#flipbook.animate .p2 {
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Responsive styles */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .pdf-container {
    height: 60vh;
  }

  .controls {
    flex-direction: column;
    align-items: center;
  }

  button {
    width: 100%;
  }

  .cover-title {
    font-size: 1.5rem;
  }
}
