* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background-color: #ffffff;
  color: #000000;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ====== ZONA DE LECTURA ====== */
#reader-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: 10px;
}

#reader {
  max-width: 90%;
  max-height: 80%;
  font-size: 48px;
  text-align: center;
  padding: 10px;
  border-radius: 4px;
}

/* ====== PANEL DE CONTROL ====== */
#control-panel {
  border-top: 1px solid rgba(0, 200, 255, 0.35);
  background: radial-gradient(circle at top, #0e2238, #050b16 65%, #040712 100%);
  color: #e5f7ff;
  padding: 8px 10px;
  box-shadow:
    0 -2px 12px rgba(0, 200, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#top-row {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

/* ====== CONFIGURACIONES ====== */
.settings-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  align-items: flex-end;
}

.setting {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  flex: 1;
}

.setting label {
  font-size: 12px;
  opacity: 0.9;
}

.setting input,
.setting select {
  padding: 6px 8px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid rgba(0, 200, 255, 0.35);
  background: rgba(255, 255, 255, 0.07);
  color: #e5f7ff;
  outline: none;
}

/* ====== BARRA DE PROGRESO (TIMELINE) ====== */
.progress-row {
  width: 100%;
  padding: 5px 2px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

#progressBar {
  width: 100%;
  cursor: pointer;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
}

#progressBar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #00c8ff;
  box-shadow: 0 0 10px rgba(0, 200, 255, 0.6);
  cursor: pointer;
  border: 1px solid #fff;
  margin-top: -5px; /* Ajuste vertical para centrar en chrome/edge */
}

#progressBar::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: rgba(0, 200, 255, 0.2);
  border-radius: 3px;
}

#progressBar:focus::-webkit-slider-thumb {
  box-shadow: 0 0 15px rgba(0, 200, 255, 0.9);
}

/* Firefox Styles */
#progressBar::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #00c8ff;
  border: 1px solid #fff;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 200, 255, 0.6);
}

/* ====== BOTONES ====== */
#top-row button,
#buttons button,
.modal-buttons button,
#help-bar button,
#floatingToggleControlsBtn,
#floatingPlayPauseBtn {
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid rgba(0, 180, 255, 0.8);
  background: radial-gradient(circle at top, #0e2238, #050b16 65%, #040712 100%);
  color: #e5f7ff;
  transition: transform 0.05s ease, box-shadow 0.2s ease;
  box-shadow:
    0 0 8px rgba(0, 200, 255, 0.45),
    0 0 18px rgba(0, 140, 255, 0.25);
}

#top-row button:hover,
#buttons button:hover,
.modal-buttons button:hover,
#help-bar button:hover,
#floatingToggleControlsBtn:hover,
#floatingPlayPauseBtn:hover {
  transform: translateY(-1px);
}

#buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 8px 0;
}

#buttons button {
  font-size: 14px;
  padding: 8px 18px;
}

/* ====== ESTADO ====== */
#status {
  font-size: 12px;
  opacity: 0.95;
  text-align: center;
  margin-bottom: 6px;
}

/* ====== AYUDA ====== */
#help-bar {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

#help-box {
  font-size: 12px;
  line-height: 1.3;
  opacity: 0.95;
  padding: 6px 8px;
  border-top: 1px dashed rgba(0, 200, 255, 0.35);
}

#help-box ul {
  padding-left: 16px;
  margin: 6px 0 0 0;
  column-count: 2;
  column-gap: 24px;
}

#help-box li {
  margin-bottom: 2px;
}

@media (max-width: 700px) {
  #help-box ul {
    column-count: 1;
  }
}

.hidden {
  display: none !important;
}

/* ====== MODAL ====== */
#text-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

#text-modal {
  width: min(800px, 92vw);
  background-color: #0b1524;
  border: 1px solid rgba(0, 200, 255, 0.35);
  border-radius: 10px;
  padding: 14px;
  color: #e5f7ff;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

#text-modal h2 {
  margin-top: 0;
  font-size: 18px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.file-row input[type="file"] {
  flex: 1;
  font-size: 13px;
}

.file-row small {
  font-size: 12px;
  opacity: 0.85;
}

#inputText {
  width: 100%;
  resize: vertical;
  font-size: 14px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(0, 200, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
  color: #e5f7ff;
  outline: none;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

#text-modal .note {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 6px;
  line-height: 1.3;
}

/* ====== MODO CINTA (HORIZONTAL) ====== */
.ticker-mode {
  white-space: nowrap;
  overflow: hidden;
}

#ticker-inner {
  display: inline-block;
  padding-left: 100%;
  animation: ticker-scroll linear infinite;
}

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* ====== MODO CINE (VERTICAL) ====== */
#reader.cinema-mode {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 0;

  background-color: #000000;
  color: #eeeeee;
  position: relative;
  overflow: hidden;
}

#cinema-inner {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;

  padding: 0 20px;
  text-align: center;
  white-space: pre-wrap;
  line-height: 1.6;

  animation-name: cinema-scroll;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes cinema-scroll {
  0% { transform: translateY(0); }
  100% { transform: translateY(-100%); }
}

/* ====== RESPONSIVE ====== */
@media (max-width: 600px) {
  #reader { font-size: 36px; }
  .setting { min-width: 120px; }
  #buttons button {
    font-size: 13px;
    padding: 7px 16px;
  }
}

/* ====== MINIMIZAR / MAXIMIZAR PANEL ====== */
#control-panel.minimized .settings-row,
#control-panel.minimized #buttons,
#control-panel.minimized #help-bar,
#control-panel.minimized #help-box,
#control-panel.minimized .progress-row { /* Ocultar barra al minimizar también */
  display: none;
}

#control-panel.minimized {
  padding-top: 6px;
  padding-bottom: 6px;
}

#control-panel.minimized #status {
  margin-bottom: 0;
  font-size: 11px;
  opacity: 0.9;
}

/* ====== BOTONES FLOTANTES (SUPERIOR DERECHA - TAMAÑO MINI) ====== */

/* Botón Maximizar (X / Maximizar) */
#floatingToggleControlsBtn {
  position: fixed;
  right: 5px;
  top: 5px;
  bottom: auto;
  z-index: 1000;
  font-size: 10px;
  padding: 4px 10px;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
}

/* Botón Play/Pause Flotante */
#floatingPlayPauseBtn {
  position: fixed;
  right: 85px;
  top: 5px;
  bottom: auto;
  z-index: 999;
  width: auto;
  height: auto;
  padding: 4px 12px;
  font-size: 10px;
  border-radius: 999px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
}