/* ============================================================
   VARIABLES Y RESET
   ============================================================ */
:root {
    --bg-dark: #0f1115;
    --bg-card: #1a1d24;
    --bg-card-hover: #22262f;
    --text-main: #ffffff;
    --text-muted: #9aa0a6;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-red: #ef4444;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --border-color: #2d333b;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}


/* ============================================================
   BOTONES
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--accent-blue);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--accent-blue-hover);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.btn-small {
    padding: 6px 16px;
    font-size: 0.8rem;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}
.btn-small:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.1);
}

/* ============================================================
   SECCIÓN HERO
   ============================================================ */
.anime-hero {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 30px;
    min-height: 420px;
    display: flex;
    align-items: center;
}

/* PORTADA (imagen horizontal grande, tipo slider) */
.hero-backdrop {
    position: absolute;
    top: 0;
    right: 0;              /* ← anclada a la derecha */
    left: auto;            /* ← anula el left:0 */
    width: 55%;            /* ← ocupa poco más de la mitad */
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 1;

    /* Difumina el borde izquierdo para que se funda con el fondo */
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0%,
        black 25%
    );
    mask-image: linear-gradient(
        to right,
        transparent 0%,
        black 25%
    );
}

/* Gradiente para legibilidad del texto */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to top,
        var(--bg-dark) 0%,
        rgba(15, 17, 21, 0.85) 40%,
        rgba(15, 17, 21, 0.3) 80%,
        transparent 100%
    );
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3;
    display: flex;
    gap: 30px;
    padding: 40px;
    width: 100%;
    align-items: center;
}

/* COVER (póster vertical) */
.hero-cover {
    flex-shrink: 0;
    width: 200px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-cover img {
    width: 100%;
    height: auto;
    display: block;
}

.hero-info {
    flex-grow: 1;
    padding-bottom: 10px;
}

.anime-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 12px;
    line-height: 1.2;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.anime-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.badge {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.badge-type {
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.badge-status {
    background-color: var(--accent-blue);
    color: #fff;
}

.meta-text {
    color: var(--text-muted);
}

.genres-anime {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.genre-tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(4px);
    background: #ffffff1f;
}

.anime-synopsis {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 1000px;
    margin-bottom: 25px;
    line-height: 1.6;

    max-height: 6.5em;
    overflow-y: auto;
    padding-right: 10px;

    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: #636b76 transparent;
}

/* Chrome, Edge, Safari */
.anime-synopsis::-webkit-scrollbar {
    width: 6px;
}

.anime-synopsis::-webkit-scrollbar-track {
    background: transparent;
}

.anime-synopsis::-webkit-scrollbar-thumb {
    background-color: #636b76;
    border-radius: 3px;
}

.anime-synopsis::-webkit-scrollbar-thumb:hover {
    background-color: #2196f3;
}

.hero-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    max-width: 600px;
}

/* ============================================================
   SECCIÓN DETALLES (ficha técnica)
   ============================================================ */
.anime-details {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.detail-value {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 500;
}

/* ============================================================
   SECTION HEADER (reutilizable)
   ============================================================ */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.episodes-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============================================================
   SECCIÓN EPISODIOS
   ============================================================ */
.episodes-section {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.episodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.episode-card {
    display: flex;
    gap: 12px;
    background-color: var(--bg-dark);
    border-radius: var(--radius-sm);
    padding: 8px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    align-items: center;
}

.episode-card:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--border-color);
    transform: translateX(4px);
}

.episode-card.active {
    border-color: var(--accent-blue);
    background-color: rgba(59, 130, 246, 0.1);
}

.ep-thumb {
    position: relative;
    width: 110px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.ep-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ep-number {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.ep-info {
    flex: 1;
    min-width: 0; /* Permite el ellipsis */
}

.ep-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #fff;
}

.ep-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   PAGINACIÓN
   ============================================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.page-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-dark);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.page-btn:hover:not(:disabled):not(.active) {
    background-color: var(--bg-card-hover);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.page-btn.active {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
    cursor: default;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-prev,
.page-next {
    font-size: 1.2rem;
    line-height: 1;
    padding-bottom: 3px;
}

.page-dots {
    color: var(--text-muted);
    padding: 0 4px;
    font-weight: 700;
    user-select: none;
}

/* ============================================================
   SECCIÓN OTRAS TEMPORADAS
   ============================================================ */
.seasons-section {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.seasons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.season-card {
    display: flex;
    flex-direction: column;
    background-color: var(--bg-dark);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.season-card:hover {
    transform: translateY(-5px);
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

/* Tarjeta de la temporada actual (resaltada) */
.season-card.current {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 1px var(--accent-blue), 0 10px 25px rgba(59, 130, 246, 0.2);
}

.season-card.current:hover {
    transform: translateY(-5px);
}

.season-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    overflow: hidden;
}

.season-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.season-card:hover .season-cover img {
    transform: scale(1.05);
}

/* Etiqueta de relación (Anterior / Siguiente / Actual / Extra) */
.season-relation {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.relation-prev {
    background-color: rgba(107, 114, 128, 0.85);
    color: #fff;
}

.relation-current {
    background-color: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}

.relation-next {
    background-color: rgba(16, 185, 129, 0.85);
    color: #fff;
}

.relation-extra {
    background-color: rgba(245, 158, 11, 0.85);
    color: #fff;
}

.season-info {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.season-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
    color: #fff;
}

.season-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.8rem;
}

/* ============================================================
   SECCIÓN RELACIONADOS
   ============================================================ */
.related-section {
    margin-bottom: 40px;
}

.related-section .section-header {
    border-bottom: none;
    padding-bottom: 0;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.related-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.related-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    border-color: rgba(59, 130, 246, 0.4);
}

.related-card img {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
}

.related-card h4 {
    padding: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ep-info i {
    font-size: 15px;
    color: #0f1115;
}

.episode-card:visited i {
    color: #2196F3;
}
/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .hero-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 20px;
    }

    .hero-cover {
        width: 150px;
    }

    .anime-meta,
    .genres-anime,
    .hero-actions {
        justify-content: center;
    }

    .anime-title {
        font-size: 1.6rem;
    }

    .episodes-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .pagination {
        gap: 6px;
    }

    .page-btn {
        min-width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }

    .seasons-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 14px;
    }

    .season-info {
        padding: 10px;
    }

    .season-info h4 {
        font-size: 0.85rem;
    }
}

main#content-full {
    max-width: 95.5%;
    margin: auto;
    margin-top: 30px;
}
@media (max-width: 768px) {
    main#content-full {margin-top: unset;}
.hero-backdrop {
        width: 100%;
        right: 0;
        -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 40%);
        mask-image: linear-gradient(to bottom, transparent 0%, black 40%);
    }

    .hero-overlay {
        background: linear-gradient(
            to top,
            var(--bg-dark) 0%,
            rgba(15, 17, 21, 0.9) 60%,
            rgba(15, 17, 21, 0.5) 100%
        );
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .hero-content {
        padding: 16px;
    }

    .anime-title {
        font-size: 1.35rem;
    }

    .anime-details,
    .episodes-section,
    .seasons-section {
        padding: 16px;
    }

    .ep-thumb {
        width: 90px;
    }

    .related-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 14px;
    }
}
