/**
 * Lector de Manga - Estilos Frontend (MangaPlus Style)
 * Metodología BEM
 */

:root {
    --wpmm-bg: #0f1015;
    --wpmm-card-bg: #1a1c23;
    --wpmm-accent: #e50914;
    --wpmm-text: #ffffff;
    --wpmm-text-muted: #a0a0a0;
    --wpmm-header-height: 56px;
    --wpmm-max-vertical-width: 850px;
}

/* Contenedor principal del Visor */
.wpmm-reader {
    position: relative;
    width: 100%;
    min-height: 100vh;
    background-color: var(--wpmm-bg);
    color: var(--wpmm-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    overflow-x: hidden;
}

/* Barra superior flotante */
.wpmm-reader__header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--wpmm-header-height);
    background: rgba(15, 16, 21, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.wpmm-reader__header.is-hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.wpmm-reader__title-box {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.wpmm-reader__manga-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wpmm-reader__manga-title:hover {
    color: var(--wpmm-accent);
}

.wpmm-reader__chapter-title {
    font-size: 12px;
    color: var(--wpmm-text-muted);
}

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

.wpmm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.wpmm-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.wpmm-btn--primary {
    background: var(--wpmm-accent);
}

.wpmm-btn--primary:hover {
    background: #c00812;
}

.wpmm-btn--active {
    background: var(--wpmm-accent);
    color: #fff;
}

.wpmm-btn-icon {
    padding: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

/* Contenedor de las páginas del manga */
.wpmm-reader__stage {
    padding-top: var(--wpmm-header-height);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* ==========================================================================
   1. MODO SCROLL VERTICAL (Estilo Webtoon / Cascada continua)
   ========================================================================== */
.wpmm-reader--vertical .wpmm-reader__pages {
    width: 100%;
    max-width: var(--wpmm-max-vertical-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

.wpmm-reader--vertical .wpmm-reader__page-wrap {
    width: 100%;
    display: block;
    margin: 0;
    padding: 0;
    line-height: 0;
    position: relative;
    background: #151515;
}

.wpmm-reader--vertical .wpmm-reader__page-img {
    width: 100%;
    height: auto;
    display: block;
    margin: 0;
    border: none;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
}

/* ==========================================================================
   2. MODO SCROLL HORIZONTAL (Estilo Manga Tradicional página a página)
   ========================================================================== */
.wpmm-reader--horizontal .wpmm-reader__stage {
    padding-top: 0;
    height: 100vh;
    overflow: hidden;
    justify-content: center;
}

.wpmm-reader--horizontal .wpmm-reader__pages {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.wpmm-reader--horizontal .wpmm-reader__page-wrap {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.wpmm-reader--horizontal .wpmm-reader__page-wrap.is-current {
    display: flex;
}

.wpmm-reader--horizontal .wpmm-reader__page-img {
    max-height: 92vh;
    max-width: 95vw;
    object-fit: contain;
    box-shadow: 0 4px 20px rgba(0,0,0,0.7);
}

/* Zonas de navegación táctil / clic en modo horizontal */
.wpmm-reader__nav-zone {
    display: none;
}

.wpmm-reader--horizontal .wpmm-reader__nav-zone {
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    width: 35%;
    z-index: 50;
    cursor: pointer;
}

.wpmm-reader--horizontal .wpmm-reader__nav-zone--prev {
    left: 0;
}

.wpmm-reader--horizontal .wpmm-reader__nav-zone--next {
    right: 0;
}

/* Barra de progreso inferior flotante */
.wpmm-reader__footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: rgba(15, 16, 21, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.wpmm-reader__footer.is-hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.wpmm-reader__progress {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
}

/* Panel Modal de Configuración (Settings Modal) */
.wpmm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.wpmm-modal.is-open {
    display: flex;
}

.wpmm-modal__dialog {
    background: var(--wpmm-card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 24px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.wpmm-modal__title {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 700;
}

.wpmm-modal__group {
    margin-bottom: 20px;
}

.wpmm-modal__group-title {
    font-size: 13px;
    color: var(--wpmm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.wpmm-switch-buttons {
    display: flex;
    gap: 8px;
}

.wpmm-switch-btn {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.wpmm-switch-btn.is-active {
    background: var(--wpmm-accent);
    border-color: var(--wpmm-accent);
}

.wpmm-select {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
}

.wpmm-select option {
    background: #222;
    color: #fff;
}

/* Pantalla final de navegación entre capítulos al final del scroll */
.wpmm-reader__chapter-nav-card {
    padding: 40px 20px;
    text-align: center;
    width: 100%;
    max-width: 600px;
    margin: 20px auto 80px auto;
    background: var(--wpmm-card-bg);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.wpmm-reader__chapter-nav-card h3 {
    margin-top: 0;
    font-size: 20px;
}

.wpmm-reader__nav-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .wpmm-reader__manga-title {
        max-width: 140px;
    }
}
