/* ==========================================================================
   ESTILOS DEL MODO REVISTA 3D REAL & INTERFAZ INNOVADORA
   VERDAD ETERNA — RODOLFO JOSÉ DELGADO COLMENARES
   ========================================================================== */

/* Contenedor del Visor 3D y Ajuste de Pantalla */
body.flipbook-mode-active {
  overflow: hidden !important;
  height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
}

body.flipbook-mode-active .top-command-bar {
  flex-shrink: 0 !important;
}

#flipbook-viewport-container {
  display: none;
  width: 100%;
  height: calc(100vh - 61px);
  position: relative;
  background: radial-gradient(circle at center, #1a1d28 0%, #08090c 100%);
  overflow: hidden;
  z-index: 100;
}

body.flipbook-mode-active #flipbook-viewport-container,
#flipbook-viewport-container.active-mode {
  display: block !important;
  flex: 1 1 auto !important;
  height: auto !important;
  min-height: 0 !important;
}

#r3d-flipbook-root {
  width: 100%;
  height: calc(100% - 95px);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

#m3d-coverflow-track {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 90px;
  background: rgba(10, 11, 14, 0.95);
  border-top: 1px solid rgba(212, 175, 55, 0.25);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0 1.5rem;
  overflow-x: auto;
  z-index: 120;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-primary, #d4af37) transparent;
}

/* Indicador flotante de modo 3D activo */
.flipbook-badge-3d {
  position: absolute;
  top: 14px;
  left: 20px;
  z-index: 105;
  background: rgba(14, 16, 22, 0.85);
  border: 1px solid var(--gold-primary, #d4af37);
  color: var(--gold-primary, #d4af37);
  padding: 5px 14px;
  border-radius: 99px;
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Estilos de las páginas del Flipbook 3D */
.flipbook-page-sheet {
  background: #141720;
  color: #f2efe9;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: calc(2.2rem * var(--sheet-scale, 1)) calc(2rem * var(--sheet-scale, 1));
  overflow-y: auto;
  font-family: var(--font-body, 'Cormorant Garamond', serif);
  font-size: calc(15px * var(--sheet-scale, 1));
  line-height: 1.7;
  position: relative;
  border: 1px solid rgba(212, 175, 55, 0.2);
  scrollbar-width: thin;
  scrollbar-color: var(--gold-primary, #d4af37) transparent;
}

.flipbook-page-sheet.cover-page {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0b0e;
  overflow: hidden;
}

.flipbook-page-sheet.cover-page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.flipbook-page-header {
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-primary, #d4af37);
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
  padding-bottom: 0.4rem;
  margin-bottom: 1.2rem;
  display: flex;
  justify-content: space-between;
}

.flipbook-page-footer {
  font-family: var(--font-mono, monospace);
  font-size: 0.65rem;
  color: var(--text-muted, #8a8478);
  border-top: 1px solid rgba(212, 175, 55, 0.2);
  padding-top: 0.4rem;
  margin-top: 1.5rem;
  display: flex;
  justify-content: space-between;
}

/* Botón Destacado del Modo 3D en la Barra Superior */
.ui-btn.btn-mode-3d {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(124, 58, 237, 0.2));
  border: 1px solid var(--gold-primary, #d4af37);
  color: var(--gold-light, #f3e5ab);
  font-weight: 700;
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.25);
}

.ui-btn.btn-mode-3d.active {
  background: linear-gradient(135deg, var(--gold-primary, #d4af37), #997a15);
  color: #0a0b0e;
  border-color: var(--gold-light, #f3e5ab);
}

/* Modal y Barra de Búsqueda Rápida en el Códice */
.codex-search-modal {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 9997;
  background: rgba(14, 16, 22, 0.96);
  border: 1px solid var(--gold-primary, #d4af37);
  border-radius: 12px;
  padding: 0.8rem 1.1rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: none;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-ui, system-ui, sans-serif);
  animation: searchSlideIn 0.2s ease;
}

.codex-search-modal.active {
  display: flex;
}

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

.codex-search-input {
  background: #08090c;
  border: 1px solid var(--border-subtle, rgba(212, 175, 55, 0.3));
  border-radius: 8px;
  color: var(--text-primary, #f2efe9);
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
  outline: none;
  width: 220px;
}

.codex-search-input:focus {
  border-color: var(--gold-primary, #d4af37);
}

.search-matches-badge {
  font-size: 0.75rem;
  color: var(--gold-primary, #d4af37);
  font-family: var(--font-mono, monospace);
  min-width: 60px;
  text-align: center;
}

/* Resaltado de búsqueda */
mark.search-highlight {
  background: rgba(212, 175, 55, 0.45);
  color: #fff;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 600;
}

mark.search-highlight.current {
  background: #d4af37;
  color: #0a0b0e;
  box-shadow: 0 0 10px #d4af37;
}

/* Banner de Continuar Lectura (Bookmark) */
.bookmark-resume-banner {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 19, 26, 0.95);
  border: 1px solid var(--gold-primary, #d4af37);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.85), 0 0 20px rgba(212, 175, 55, 0.2);
  border-radius: 99px;
  padding: 0.5rem 1.4rem;
  z-index: 9995;
  display: none;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-ui, system-ui, sans-serif);
  backdrop-filter: blur(16px);
  animation: bannerDrop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.bookmark-resume-banner.active {
  display: flex;
}

@keyframes bannerDrop {
  from { opacity: 0; transform: translate(-50%, -15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.bookmark-resume-text {
  font-size: 0.82rem;
  color: var(--text-primary, #f2efe9);
}

.bookmark-resume-btn {
  background: var(--gold-primary, #d4af37);
  color: #0a0b0e;
  font-weight: 700;
  border: none;
  padding: 0.35rem 0.9rem;
  border-radius: 99px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: transform 0.2s;
}

.bookmark-resume-btn:hover {
  transform: scale(1.05);
}

.bookmark-dismiss-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #8a8478);
  cursor: pointer;
  font-size: 0.9rem;
}

/* Tema Cuántico / Astral adicional */
[data-theme="astral"] {
  --bg-primary: #050b14;
  --bg-secondary: #0a1324;
  --bg-card: #0f1c34;
  --bg-elevated: #16284a;
  --text-primary: #e6f1ff;
  --text-secondary: #94b8db;
  --text-muted: #537599;
  --gold-primary: #38bdf8;
  --gold-light: #7dd3fc;
  --gold-dark: #0284c7;
  --accent-crimson: #6366f1;
  --border-subtle: rgba(56, 189, 248, 0.22);
  --border-strong: rgba(56, 189, 248, 0.55);
  --shadow-luxury: 0 20px 50px rgba(2, 20, 50, 0.8);
}
