/**
 * AnimeHub Homepage Styles
 *
 * Hero slider, sections, and homepage-specific components
 *
 * @package AnimeHub
 */

/* ==========================================================================
   Hero Section
   ========================================================================== */

.hero-section {
    position: relative;
    height: 600px;
    overflow: hidden;
    background: var(--animehub-bg-secondary);
}

.hero-slider {
    position: relative;
    height: 100%;
}

.hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease, transform 0.8s ease;
    will-change: opacity, transform;
}

.hero-slide.active {
    opacity: 1;
    visibility: visible;
}

/* Slide Effect */
.hero-slider--slide .hero-slide {
    transform: translateX(100%);
}

.hero-slider--slide .hero-slide.active {
    transform: translateX(0);
}

/* Cube Effect */
.hero-slider--cube {
    perspective: 1200px;
}

.hero-slider--cube .hero-slide {
    transform: rotateY(90deg);
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.hero-slider--cube .hero-slide.active {
    transform: rotateY(0deg);
}

/* Flip Effect */
.hero-slider--flip {
    perspective: 1200px;
}

.hero-slider--flip .hero-slide {
    transform: rotateY(180deg);
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.hero-slider--flip .hero-slide.active {
    transform: rotateY(0deg);
}

/* Coverflow Effect */
.hero-slider--coverflow {
    perspective: 1200px;
}

.hero-slider--coverflow .hero-slide {
    transform: translateX(100%) rotateY(45deg) scale(0.8);
    transform-style: preserve-3d;
    transition: opacity 0.8s ease, visibility 0.8s ease, transform 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.hero-slider--coverflow .hero-slide.active {
    transform: translateX(0) rotateY(0deg) scale(1);
    z-index: 2;
}

.hero-slider--coverflow .hero-slide:not(.active) {
    opacity: 0.5;
}

/* Fade Effect (Default) */
.hero-slider--fade .hero-slide {
    transform: none;
}

.hero-slide__bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

.hero-slide__bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to right,
        rgba(10, 10, 10, 0.95) 0%,
        rgba(10, 10, 10, 0.7) 40%,
        rgba(10, 10, 10, 0.3) 70%,
        rgba(10, 10, 10, 0.5) 100%
    );
}

.hero-slide__content {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    z-index: 1;
    padding-left: var(--animehub-gap);
}

.hero-section .container {
    padding-left: 0;
}

.hero-slide__wrapper {
    display: flex;
    align-items: center;
    gap: 30px;
}

.hero-slide__poster {
    flex-shrink: 0;
    width: 280px;
    aspect-ratio: 2 / 3;
    border-radius: var(--animehub-radius);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.hero-slide__poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-slide__info {
    flex: 1;
    max-width: 600px;
}

.hero-slide__badges {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.hero-slide__title {
    font-size: 48px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.hero-slide__genres {
    font-size: 14px;
    color: var(--animehub-text-secondary);
    margin-bottom: 15px;
}

.hero-slide__excerpt {
    font-size: 16px;
    color: var(--animehub-text-secondary);
    line-height: 1.7;
    margin-bottom: 30px;
}

.hero-slide__actions {
    display: flex;
    gap: 15px;
}

/* Hero Controls */
.hero-controls {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.hero-prev,
.hero-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: all var(--animehub-transition);
    z-index: 10;
    aspect-ratio: 1 / 1;
}

.hero-prev {
    left: 30px;
}

.hero-next {
    right: 30px;
}

.hero-prev:hover,
.hero-next:hover {
    background: var(--animehub-primary);
    border-color: var(--animehub-primary);
    transform: translateY(-50%) scale(1.1);
}

.hero-prev svg,
.hero-next svg {
    width: 24px;
    height: 24px;
}

.hero-dots {
    display: flex;
    gap: 10px;
}

.hero-dot {
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--animehub-transition);
    padding: 0;
}

.hero-dot.active,
.hero-dot:hover {
    background: var(--animehub-primary);
    transform: scale(1.2);
}

/* ==========================================================================
   Home Sections
   ========================================================================== */

.home-section {
    margin: 50px 0;
}

/* Section Columns */
.home-section.section-columns-2 .cards-grid {
    grid-template-columns: repeat(2, 1fr) !important;
}

.home-section.section-columns-3 .cards-grid {
    grid-template-columns: repeat(3, 1fr) !important;
}

.home-section.section-columns-4 .cards-grid {
    grid-template-columns: repeat(4, 1fr) !important;
}

.home-section.section-columns-5 .cards-grid {
    grid-template-columns: repeat(5, 1fr) !important;
}

.home-section.section-columns-6 .cards-grid {
    grid-template-columns: repeat(6, 1fr) !important;
}

/* Override .cards-grid--anime for homepage sections to respect column settings */
.home-section .cards-grid--anime {
    grid-template-rows: auto !important;
}

.home-section.section-columns-2 .cards-grid--anime {
    grid-template-columns: repeat(2, 1fr) !important;
}

.home-section.section-columns-3 .cards-grid--anime {
    grid-template-columns: repeat(3, 1fr) !important;
}

.home-section.section-columns-4 .cards-grid--anime {
    grid-template-columns: repeat(4, 1fr) !important;
}

.home-section.section-columns-5 .cards-grid--anime {
    grid-template-columns: repeat(5, 1fr) !important;
}

.home-section.section-columns-6 .cards-grid--anime {
    grid-template-columns: repeat(6, 1fr) !important;
}

/* Override .cards-grid--episode and .cards-grid--latest_episodes for homepage sections to respect column settings */
.home-section .cards-grid--episode,
.home-section .cards-grid--latest_episodes {
    grid-template-rows: auto !important;
}

.home-section.section-columns-2 .cards-grid--episode,
.home-section.section-columns-2 .cards-grid--latest_episodes {
    grid-template-columns: repeat(2, 1fr) !important;
}

.home-section.section-columns-3 .cards-grid--episode,
.home-section.section-columns-3 .cards-grid--latest_episodes {
    grid-template-columns: repeat(3, 1fr) !important;
}

.home-section.section-columns-4 .cards-grid--episode,
.home-section.section-columns-4 .cards-grid--latest_episodes {
    grid-template-columns: repeat(4, 1fr) !important;
}

.home-section.section-columns-5 .cards-grid--episode,
.home-section.section-columns-5 .cards-grid--latest_episodes {
    grid-template-columns: repeat(5, 1fr) !important;
}

.home-section.section-columns-6 .cards-grid--episode,
.home-section.section-columns-6 .cards-grid--latest_episodes {
    grid-template-columns: repeat(6, 1fr) !important;
}

/* Section View Types */
.home-section.section-view-list .cards-grid {
    grid-template-columns: 1fr;
    gap: 16px;
}

.home-section.section-view-list .anime-card,
.home-section.section-view-list .episode-card,
.home-section.section-view-list .video-card {
    display: flex;
    flex-direction: row;
    gap: 20px;
}

.home-section.section-view-slider {
    position: relative;
}

.home-section.section-view-slider .slider-container {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 10px;
}

.home-section.section-view-slider .slider-container::-webkit-scrollbar {
    display: none;
}

.home-section.section-view-slider .slider-container.cards-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 60px) / var(--slider-items, 4));
    gap: 20px;
    overflow-x: auto;
}

/* Force grid layout for all sections regardless of view_type setting */
.home-section .cards-grid {
    display: grid !important;
    grid-auto-flow: row !important;
    overflow-x: visible !important;
}

/* Remove slider-specific overrides for sections - all use grid now */
.home-section.section-view-slider .cards-grid,
.home-section.section-view-list .cards-grid {
    display: grid !important;
    grid-auto-flow: row !important;
    grid-auto-columns: auto !important;
    overflow-x: visible !important;
}

.home-section.section-view-slider .slider-container.cards-grid > * {
    scroll-snap-align: start;
}

.home-section.section-view-slider[data-columns="2"] .slider-container > * {
    --slider-items: 2;
}

.home-section.section-view-slider[data-columns="3"] .slider-container > * {
    --slider-items: 3;
}

.home-section.section-view-slider[data-columns="4"] .slider-container > * {
    --slider-items: 4;
}

.home-section.section-view-slider[data-columns="5"] .slider-container > * {
    --slider-items: 5;
}

.home-section.section-view-slider[data-columns="6"] .slider-container > * {
    --slider-items: 6;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    position: relative;
    padding-left: 15px;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 28px;
    background: var(--animehub-primary);
    border-radius: 2px;
}

.section-link {
    font-size: 14px;
    color: var(--animehub-text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color var(--animehub-transition);
}

.section-link:hover {
    color: var(--animehub-primary);
}

/* ==========================================================================
   Two Column Layout
   ========================================================================== */

.home-two-columns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
    margin: 50px 0;
}

/* ==========================================================================
   Ranking List
   ========================================================================== */

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: var(--animehub-bg-card);
    border: 1px solid var(--animehub-border);
    border-radius: var(--animehub-radius);
    color: inherit;
    text-decoration: none;
    transition: all var(--animehub-transition);
}

.ranking-item:hover {
    border-color: var(--animehub-primary);
    transform: translateX(5px);
}

.ranking-item__rank {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--animehub-bg-secondary);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--animehub-text-secondary);
}

.ranking-item:nth-child(1) .ranking-item__rank {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #000;
}

.ranking-item:nth-child(2) .ranking-item__rank {
    background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
    color: #000;
}

.ranking-item:nth-child(3) .ranking-item__rank {
    background: linear-gradient(135deg, #cd7f32, #a0522d);
    color: #fff;
}

.ranking-item__poster {
    width: 50px;
    height: 70px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.ranking-item__poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ranking-item__info {
    flex: 1;
    min-width: 0;
}

.ranking-item__title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-item__score {
    font-size: 13px;
    color: #ffc107;
    font-weight: 600;
}

.ranking-item__meta {
    font-size: 12px;
    color: var(--animehub-text-muted);
}

/* ==========================================================================
   Featured Grid
   ========================================================================== */

.featured-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: repeat(2, 200px);
    gap: 15px;
}

.featured-item {
    position: relative;
    border-radius: var(--animehub-radius);
    overflow: hidden;
    background: var(--animehub-bg-card);
}

.featured-item--large {
    grid-row: span 2;
}

.featured-item__bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform var(--animehub-transition-slow);
}

.featured-item:hover .featured-item__bg {
    transform: scale(1.05);
}

.featured-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 60%);
}

.featured-item__content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    z-index: 1;
}

.featured-item__title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
}

.featured-item--large .featured-item__title {
    font-size: 24px;
}

.featured-item__meta {
    font-size: 13px;
    color: var(--animehub-text-secondary);
}

/* ==========================================================================
   Schedule Section
   ========================================================================== */

.schedule-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    padding: 5px;
    background: var(--animehub-bg-card);
    border-radius: var(--animehub-radius-sm);
}

.schedule-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--animehub-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--animehub-transition);
}

.schedule-tab:hover,
.schedule-tab.active {
    background: var(--animehub-primary);
    color: #fff;
}

.schedule-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--animehub-bg-card);
    border: 1px solid var(--animehub-border);
    border-radius: var(--animehub-radius);
    margin-bottom: 10px;
    text-decoration: none;
    color: inherit;
    transition: all var(--animehub-transition);
}

.schedule-item:hover {
    border-color: var(--animehub-primary);
}

.schedule-item__time {
    flex-shrink: 0;
    padding: 8px 12px;
    background: var(--animehub-bg-secondary);
    border-radius: 6px;
    font-family: var(--animehub-font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--animehub-primary);
}

.schedule-item__poster {
    width: 45px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.schedule-item__poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.schedule-item__info {
    flex: 1;
}

.schedule-item__title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 3px;
}

.schedule-item__episode {
    font-size: 13px;
    color: var(--animehub-text-secondary);
}

/* ==========================================================================
   News Card
   ========================================================================== */

.news-card {
    background: var(--animehub-bg-card);
    border-radius: var(--animehub-radius);
    overflow: hidden;
    transition: transform var(--animehub-transition), box-shadow var(--animehub-transition);
}

.news-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--animehub-shadow-lg);
}

.news-card__link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.news-card__thumbnail {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--animehub-bg-secondary);
}

.news-card__thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--animehub-transition-slow);
}

.news-card:hover .news-card__thumbnail img {
    transform: scale(1.05);
}

.news-card__content {
    padding: 20px;
}

.news-card__title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.4;
    color: var(--animehub-text);
}

.news-card__meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--animehub-text-secondary);
    margin-bottom: 12px;
}

.news-card__excerpt {
    font-size: 14px;
    color: var(--animehub-text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* ==========================================================================
   Schedule
   ========================================================================== */

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.schedule-day {
    background: var(--animehub-bg-card);
    border-radius: var(--animehub-radius);
    padding: 20px;
}

.schedule-day__title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--animehub-primary);
    color: var(--animehub-text);
}

.schedule-day__items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.schedule-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--animehub-bg-secondary);
    border-radius: var(--animehub-radius-sm);
    transition: background var(--animehub-transition);
    text-decoration: none;
    color: inherit;
}

.schedule-item:hover {
    background: var(--animehub-bg-elevated);
}

.schedule-item__poster {
    flex-shrink: 0;
    width: 60px;
    height: 84px;
    border-radius: var(--animehub-radius-sm);
    overflow: hidden;
    background: var(--animehub-bg);
}

.schedule-item__poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.schedule-item__info {
    flex: 1;
    min-width: 0;
}

.schedule-item__title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--animehub-text);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.schedule-item__time,
.schedule-item__episode {
    font-size: 12px;
    color: var(--animehub-text-secondary);
    display: block;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
    .hero-section {
        height: 500px;
    }

    .hero-slide__title {
        font-size: 36px;
    }

    .hero-slide__wrapper {
        gap: 20px;
    }

    .hero-slide__poster {
        width: 200px;
    }

    .hero-slide__info {
        max-width: 500px;
    }

    .home-two-columns {
        grid-template-columns: 1fr;
    }

    .featured-grid {
        grid-template-columns: 1fr 1fr;
    }

    .featured-item--large {
        grid-column: span 2;
        grid-row: span 1;
    }
}

@media (max-width: 768px) {
    .hero-section {
        height: 450px;
    }

    .hero-slide__wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .hero-slide__poster {
        width: 160px;
        align-self: center;
    }

    .hero-slide__title {
        font-size: 28px;
    }

    .hero-slide__excerpt {
        display: none;
    }

    .hero-slide__actions {
        flex-direction: column;
    }

    .hero-slide__actions .btn {
        width: 100%;
    }

    .hero-controls {
        bottom: 20px;
    }

    .hero-prev {
        left: 15px;
        width: 48px;
        height: 48px;
    }

    .hero-next {
        right: 15px;
        width: 48px;
        height: 48px;
    }

    .hero-prev svg,
    .hero-next svg {
        width: 20px;
        height: 20px;
    }

    .section-title {
        font-size: 20px;
    }

    .featured-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .featured-item--large {
        grid-column: span 1;
    }
}

@media (max-width: 480px) {
    .hero-section {
        height: 400px;
    }

    .hero-slide__title {
        font-size: 22px;
    }

    .hero-slide__badges {
        margin-bottom: 15px;
    }

    .hero-slide__genres {
        font-size: 12px;
    }

    .hero-prev,
    .hero-next {
        width: 44px;
        height: 44px;
        left: 10px;
        right: 10px;
    }

    .hero-prev svg,
    .hero-next svg {
        width: 18px;
        height: 18px;
    }

    .ranking-item__poster {
        width: 40px;
        height: 56px;
    }
    
    .hero-slide__action {
        min-height: 44px;
        padding: 12px 20px;
    }
}
