/* Lector de imagenes -  esto es la pagina donde lees los capitulos */
/* Estilo inspirado en nhentai: fondo oscuro, barra superior fija */

:root {
    --bg: #0f0f0f;
    --bar-bg: #1c1c1c;
    --text-color: #efefef;
    --accent-color: #ff4e6f;
    --border-color: #2c2c2c;
}

body {
    background-color: var(--bg);
    color: var(--text-color);
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    /* flexbox para que el viewport ocupe todo el alto disponible */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* user-select: none evita seleccion de texto al hacer tap en imagenes */
    user-select: none;
}

/* Barra de navegacion superior - sticky para que siempre se vea al hacer scroll hacia arriba */
.reader-nav {
    background-color: var(--bar-bg);
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.back-link {
    color: #ccc;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.back-link:hover {
    color: white;
}

/* Titulo del doujin truncado con ellipsis si es muy largo */
.doujin-title-header {
    font-size: 14px;
    font-weight: normal;
    color: #888;
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* En pantallas menores a 600px no hay espacio para el titulo, se oculta */
@media (max-width: 600px) {
    .doujin-title-header {
        display: none;
    }
}

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

/* Botones de navegacion (anterior/siguiente/zoom) */
.nav-btn {
    background: #2a2a2a;
    color: white;
    border: 1px solid #3d3d3d;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: #3a3a3a;
    border-color: #555;
}

.nav-btn:active {
    background: #1a1a1a;
}

.nav-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Selector de pagina con estilo personalizado */
.page-selector-wrapper {
    display: flex;
    align-items: center;
    background: #252525;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    padding: 0 8px;
    height: 34px;
}

.page-selector-wrapper select {
    background: transparent;
    color: white;
    border: none;
    font-size: 14px;
    font-weight: bold;
    outline: none;
    cursor: pointer;
    padding: 6px 4px;
}

.page-selector-wrapper select option {
    background: var(--bar-bg);
    color: white;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Area donde se muestra la imagen - ocupa todo el espacio vertical disponible */
.reader-viewport {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px 0;
    box-sizing: border-box;
    background-color: var(--bg);
}

/* Contenedor de la imagen con cursor pointer para hacer tap y cambiar de pagina */
.image-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
    cursor: pointer;
}

.reader-image {
    display: block;
    margin: 0 auto;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    /* transicion suave al cambiar de modo de ajuste */
    transition: max-height 0.15s ease, max-width 0.15s ease;
}

/* Modo "Ajustar a pantalla" - la imagen se escala para entrar en el viewport */
.reader-image.fit-screen {
    max-height: calc(100vh - 120px);
    max-width: 95vw;
    object-fit: contain;
}

/* Modo "Ajustar a ancho" - la imagen se ve a su ancho original maximo 900px */
.reader-image.fit-width {
    max-width: 900px;
    width: 95vw;
    height: auto;
}

/* Zonas de tap para navegar sin usar los botones */
/* Cubren el 40% izquierdo y derecho de la imagen */
.nav-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    z-index: 10;
}

.nav-zone.left {
    left: 0;
}

.nav-zone.right {
    right: 0;
}

/* Toast que muestra el numero de pagina al cambiar */
/* position: fixed lo mantiene en la misma posicion aunque scrollees */
.toast {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    z-index: 2000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.toast.show {
    opacity: 1;
}

/* Navegacion inferior para lectura larga (dobles paginas) */
.bottom-nav {
    background-color: var(--bar-bg);
    padding: 15px;
    display: flex;
    justify-content: center;
    border-top: 1px solid var(--border-color);
}
