* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  height: -webkit-fill-available; /* Ajuste preciso para navegadores móviles */
  overflow: hidden;
  background-color: #121212;
  color: #ffffff;
  font-family: Arial, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Loader */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(18, 18, 18, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #333;
  border-top: 5px solid #e50914;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Área Central */
.container {
  width: 100%;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 5px;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.flipbook {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  visibility: hidden;
}

.page {
  background-color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
}

.page canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Barra Inferior de Controles */
.controls-bar {
  width: 100%;
  height: 48px;
  background-color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  z-index: 100;
  border-top: 1px solid #222;
  flex-shrink: 0;
  padding: 0 5px;
}

button, .btn-link {
  background: transparent;
  color: #ccc;
  border: 1px solid transparent;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.2s ease;
}

button:hover, .btn-link:hover {
  background: #222;
  color: #fff;
  border-color: #444;
}

.divider {
  width: 1px;
  height: 20px;
  background-color: #333;
  margin: 0 2px;
}

/* Selector de Páginas */
.page-input-box {
  display: flex;
  align-items: center;
  background: #fff;
  color: #000;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: bold;
}

.page-input-box input {
  width: 26px;
  border: none;
  outline: none;
  text-align: right;
  font-weight: bold;
  font-size: 12px;
}

.page-input-box input::-webkit-outer-spin-button,
.page-input-box input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

@media (max-width: 600px) {
  .controls-bar {
    gap: 2px;
  }
  
  button, .btn-link {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .divider {
    display: none;
  }
}

/* Modales y Miniaturas */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: #1e1e1e;
  padding: 20px;
  border-radius: 8px;
  width: 280px;
  text-align: center;
  position: relative;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 20px;
  cursor: pointer;
}

.share-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

.share-buttons button {
  width: 100%;
  height: 40px;
  background: #2a2a2a;
}

.thumbnails-panel {
  position: fixed;
  bottom: 48px;
  left: 0;
  width: 100%;
  height: 150px;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  flex-direction: column;
  z-index: 500;
  border-top: 1px solid #333;
}

.thumbnails-header {
  display: flex;
  justify-content: space-between;
  padding: 5px 15px;
  font-size: 12px;
  background: #111;
}

.thumbnails-container {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px;
}

.thumb-item {
  height: 100px;
  cursor: pointer;
  border: 2px solid transparent;
}

.thumb-item:hover {
  border-color: #e50914;
}

.thumb-item canvas {
  height: 100%;
  width: auto;
}