/* ==========================================================================
   1. BASE & RESET
   ========================================================================== */
* {
    box-sizing: border-box;
    max-width: 100vw; /* Evita que cualquier elemento desborde el ancho del móvil */
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden; /* Prohíbe el scroll lateral (causante del zoom) */
}

body {
    background-color: #0d0f10;
    background-image: url('../images/BG/BG_02.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: #efefef;
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.5;
}
.comic-pdf {
    width: 100%;
    height: 90vh;
    border: none;
    border-radius: 12px;
    background: white;
}
.viewer-content.pdf-mode {
    width: 98vw;
    max-width: 1400px;
    height: 95vh;
}

.viewer-content.pdf-mode .comic-pdf {
    width: 100%;
    height: 85vh;
    border-radius: 12px;
}
#mediaContainer {
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   2. LAYOUT & CONTAINERS
   ========================================================================== */
.container-main {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}

/* Contenedor del Banner para asegurar centrado */
.top-banner-nuu {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 10px 0;
}

.page-header-logo {
    display: block;
    width: 100%;
    max-width: 600px; /* Tamaño optimizado para vertical */
    height: auto !important;
    border-radius: 15px;
    object-fit: contain;
}

/* ==========================================================================
   3. BUSCADOR (SEARCH)
   ========================================================================== */
.search-section {
    position: relative; /* Cambiado de absolute para no romper el flujo */
    width: 100%;
    max-width: 500px;
    margin: 20px auto;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    z-index: 10;
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 50px;
    background: #1a1d1f;
    border: 1px solid #33383f;
    border-radius: 12px;
    padding: 0 20px 0 45px; /* Espacio para el icono */
    color: white;
    font-size: 16px; /* 16px evita el zoom automático en iOS al clicar */
    outline: none;
    transition: border-color 0.3s;
}

.search-input:focus {
    border-color: #ff2d55;
}

/* ==========================================================================
   4. FILTROS
   ========================================================================== */
.filters {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 20px auto 30px;
}

.filter-btn {
    background: #1a1d1f;
    border: 1px solid #33383f;
    color: #9ca3af;
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: #272b30;
    color: white;
}

.filter-btn.active {
    background: #ff2d55;
    border-color: #ff2d55;
    color: white;
    box-shadow: 0 0 15px rgba(255, 45, 85, 0.3);
}

.exit-btn {
    min-width: 50px;
}

.exit-btn img {
    filter: brightness(0) invert(1);
    width: 20px;
    height: 20px;
}

/* ==========================================================================
   5. GRID DE TARJETAS
   ========================================================================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Forzado a 3 columnas en móvil */
    gap: 12px;
    padding-bottom: 40px;
}

.card-item {
    background: #1a1d1f;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #2a2a2a;
    transition: transform 0.2s;
    cursor: pointer;
}

.card-image-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #111;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card-info {
    padding: 8px;
    text-align: center;
}

.card-number {
    display: block;
    font-size: 11px;
    color: #ff2d55;
    font-weight: bold;
}

.card-name {
    font-size: 12px;
    color: #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   6. VISOR MODAL (CORREGIDO)
   ========================================================================== */
.comic-viewer {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.98);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* Eliminamos touch-action: none para permitir zoom manual si el usuario quiere */
}

.viewer-content {
    position: relative;
    width: 95%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.comic-video, .comic-img {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.viewer-caption {
    margin-top: 15px;
    font-size: 18px;
    color: white;
    text-align: center;
}

.viewer-close {
    position: absolute;
    top: -70px;
    right: 0;
    background: #1a1d1f;
    border: 1px solid #33383f;
    color: white;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    font-size: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* ==========================================================================
   7. RESPONSIVE QUERIES
   ========================================================================== */

/* Tablets */
@media (min-width: 650px) {
    .cards-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 15px;
    }
}

/* PC */
@media (min-width: 1100px) {
    .cards-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    .page-header-logo {
        max-width: 800px;
    }
}