/**
 * AnimeHub Homepage Styles
 *
 * Hero slider, sections, and homepage-specific components
 *
 * @package AnimeHub
 */

/* ==========================================================================
   CRITICAL OVERRIDE: Mobile Responsive Fix
   This must be at the very top to ensure it loads first
   ========================================================================== */

/* Force 2 columns on ALL mobile screens for homepage */
@media (max-width: 1399px) {
    .homepage .home-section .cards-grid--anime,
    .homepage .home-section .cards-grid--episode,
    .homepage .home-section .cards-grid--video,
    .site-main.homepage .home-section .cards-grid--anime,
    .site-main.homepage .home-section .cards-grid--episode,
    .site-main.homepage .home-section .cards-grid--video,
    body .homepage .home-section .cards-grid--anime,
    body .homepage .home-section .cards-grid--episode,
    body .homepage .home-section .cards-grid--video {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .homepage .home-section.section-columns-2 .cards-grid,
    .homepage .home-section.section-columns-3 .cards-grid,
    .homepage .home-section.section-columns-4 .cards-grid,
    .homepage .home-section.section-columns-5 .cards-grid,
    .homepage .home-section.section-columns-6 .cards-grid,
    .site-main.homepage .home-section.section-columns-2 .cards-grid,
    .site-main.homepage .home-section.section-columns-3 .cards-grid,
    .site-main.homepage .home-section.section-columns-4 .cards-grid,
    .site-main.homepage .home-section.section-columns-5 .cards-grid,
    .site-main.homepage .home-section.section-columns-6 .cards-grid,
    body .homepage .home-section.section-columns-2 .cards-grid,
    body .homepage .home-section.section-columns-3 .cards-grid,
    body .homepage .home-section.section-columns-4 .cards-grid,
    body .homepage .home-section.section-columns-5 .cards-grid,
    body .homepage .home-section.section-columns-6 .cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ==========================================================================
   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);
    padding-right: var(--animehub-gap);
    padding-bottom: 0;
}

.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;
    min-width: 0; /* Cho phép flex item co lại đúng cách */
}

.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);
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.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;
    pointer-events: none;
}

.hero-controls * {
    pointer-events: auto;
}

.hero-prev,
.hero-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.hero-prev {
    left: 30px;
}

.hero-next {
    right: 30px;
}

/* Hover state - enhanced with scale and glow */
.hero-prev:hover:not(:disabled),
.hero-next:hover:not(:disabled) {
    background: var(--animehub-primary);
    border-color: var(--animehub-primary);
    box-shadow: 0 6px 24px rgba(255, 107, 53, 0.6), 0 0 0 4px rgba(255, 107, 53, 0.1);
    transform: translateY(-50%) scale(1.1);
}

/* Active/Click state */
.hero-prev:active:not(:disabled),
.hero-next:active:not(:disabled) {
    background: var(--animehub-primary-hover, #e55a2a);
    box-shadow: 0 3px 12px rgba(255, 107, 53, 0.5);
    transform: translateY(-50%) scale(1.05);
}

/* Disabled state (for single slide or when needed) */
.hero-prev:disabled,
.hero-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    pointer-events: none;
}

.hero-prev:disabled:hover,
.hero-next:disabled:hover {
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

/* Focus state for accessibility */
.hero-prev:focus:not(:disabled),
.hero-next:focus:not(:disabled) {
    outline: none;
    border-color: var(--animehub-primary);
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
}

.hero-prev svg,
.hero-next svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Arrow animation on hover */
.hero-prev:hover:not(:disabled) svg {
    transform: translateX(-3px);
}

.hero-next:hover:not(:disabled) svg {
    transform: translateX(3px);
}

.hero-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.hero-dot {
    width: 12px;
    height: 12px;
    min-width: 12px;
    min-height: 12px;
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    position: relative;
    overflow: visible;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.hero-dot::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-dot:hover {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.3);
}

.hero-dot:hover::before {
    background: rgba(255, 107, 53, 0.2);
}

.hero-dot.active {
    width: 32px;
    height: 12px;
    background: var(--animehub-primary);
    border-color: var(--animehub-primary);
    border-radius: 6px;
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.5);
}

.hero-dot.active::before {
    background: transparent;
}

.hero-dot:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.3);
}

.hero-dot:active {
    transform: scale(0.95);
}

/* ==========================================================================
   Home Sections
   ========================================================================== */

.home-section {
    margin: 50px 0;
}

/* ==========================================================================
   CRITICAL: Mobile-First Responsive Override
   This section MUST override all desktop rules from base.css and other files
   ========================================================================== */

/* Mobile default: Force 2 columns for all homepage cards */
/* Highest specificity to override base.css rules */
body.home .homepage .home-section .cards-grid--anime,
body.home .homepage .home-section .cards-grid--episode,
body.home .homepage .home-section .cards-grid--video,
body.home .home-section .cards-grid--anime,
body.home .home-section .cards-grid--episode,
body.home .home-section .cards-grid--video,
.homepage .home-section .cards-grid--anime,
.homepage .home-section .cards-grid--episode,
.homepage .home-section .cards-grid--video,
.home-section .cards-grid--anime,
.home-section .cards-grid--episode,
.home-section .cards-grid--video {
    grid-template-columns: repeat(2, 1fr) !important;
}

body.home .homepage .home-section .cards-grid--news,
body.home .home-section .cards-grid--news,
.homepage .home-section .cards-grid--news,
.home-section .cards-grid--news {
    grid-template-columns: repeat(1, 1fr) !important;
}

/* Override any section-columns rules on mobile */
body.home .homepage .home-section.section-columns-2 .cards-grid,
body.home .homepage .home-section.section-columns-3 .cards-grid,
body.home .homepage .home-section.section-columns-4 .cards-grid,
body.home .homepage .home-section.section-columns-5 .cards-grid,
body.home .homepage .home-section.section-columns-6 .cards-grid,
body.home .home-section.section-columns-2 .cards-grid,
body.home .home-section.section-columns-3 .cards-grid,
body.home .home-section.section-columns-4 .cards-grid,
body.home .home-section.section-columns-5 .cards-grid,
body.home .home-section.section-columns-6 .cards-grid,
.homepage .home-section.section-columns-2 .cards-grid,
.homepage .home-section.section-columns-3 .cards-grid,
.homepage .home-section.section-columns-4 .cards-grid,
.homepage .home-section.section-columns-5 .cards-grid,
.homepage .home-section.section-columns-6 .cards-grid,
.home-section.section-columns-2 .cards-grid,
.home-section.section-columns-3 .cards-grid,
.home-section.section-columns-4 .cards-grid,
.home-section.section-columns-5 .cards-grid,
.home-section.section-columns-6 .cards-grid {
    grid-template-columns: repeat(2, 1fr) !important;
}

/* Ensure consistent spacing for first and last sections */
.home-section:first-child {
    margin-top: 0;
}

.home-section:last-child {
    margin-bottom: 0;
}

/* Consistent spacing within homepage groups */
.homepage-group .home-section:first-child {
    margin-top: 0;
}

.homepage-group .home-section:last-child {
    margin-bottom: 0;
}

/* Standalone sections (not in groups) should have consistent spacing */
.homepage > .container > .home-section:first-child {
    margin-top: 0;
}

.homepage > .container > .home-section:last-child {
    margin-bottom: 0;
}

/* Section Columns - Optimized with attribute selector */
.home-section .cards-grid {
    grid-template-rows: auto;
}

/* Base column settings using attribute selector for better specificity */
/* Mobile-first: All sections start with 2 columns on mobile */
/* This is already covered by the critical rules above, but keeping for specificity */
body.home .homepage .home-section.section-columns-2 .cards-grid,
body.home .homepage .home-section.section-columns-3 .cards-grid,
body.home .homepage .home-section.section-columns-4 .cards-grid,
body.home .homepage .home-section.section-columns-5 .cards-grid,
body.home .homepage .home-section.section-columns-6 .cards-grid,
body.home .home-section.section-columns-2 .cards-grid,
body.home .home-section.section-columns-3 .cards-grid,
body.home .home-section.section-columns-4 .cards-grid,
body.home .home-section.section-columns-5 .cards-grid,
body.home .home-section.section-columns-6 .cards-grid,
.homepage .home-section.section-columns-2 .cards-grid,
.homepage .home-section.section-columns-3 .cards-grid,
.homepage .home-section.section-columns-4 .cards-grid,
.homepage .home-section.section-columns-5 .cards-grid,
.homepage .home-section.section-columns-6 .cards-grid,
.home-section.section-columns-2 .cards-grid,
.home-section.section-columns-3 .cards-grid,
.home-section.section-columns-4 .cards-grid,
.home-section.section-columns-5 .cards-grid,
.home-section.section-columns-6 .cards-grid {
    grid-template-columns: repeat(2, 1fr) !important;
}

/* Responsive overrides for custom section columns - scale up on larger screens */
/* Only apply on desktop screens */
@media (min-width: 1400px) {
    body.home .homepage .home-section.section-columns-3 .cards-grid,
    .homepage .home-section.section-columns-3 .cards-grid,
    .home-section.section-columns-3 .cards-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    body.home .homepage .home-section.section-columns-4 .cards-grid,
    .homepage .home-section.section-columns-4 .cards-grid,
    .home-section.section-columns-4 .cards-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    body.home .homepage .home-section.section-columns-5 .cards-grid,
    .homepage .home-section.section-columns-5 .cards-grid,
    .home-section.section-columns-5 .cards-grid {
        grid-template-columns: repeat(5, 1fr) !important;
    }
    body.home .homepage .home-section.section-columns-6 .cards-grid,
    .homepage .home-section.section-columns-6 .cards-grid,
    .home-section.section-columns-6 .cards-grid {
        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 */
.home-section .cards-grid {
    display: grid !important;
    grid-auto-flow: row;
    overflow-x: visible;
    gap: 20px;
}

/* Ensure all cards in grid have proper width */
.home-section .cards-grid > * {
    width: 100%;
    min-width: 0;
}

/* Default grid columns for card types (when columns not specified) */
/* Mobile-first approach: Start with 2 columns, then scale up */
.home-section:not([class*="section-columns"]) .cards-grid--anime,
.home-section:not([class*="section-columns"]) .cards-grid--episode {
    grid-template-columns: repeat(2, 1fr) !important;
}

.home-section:not([class*="section-columns"]) .cards-grid--video {
    grid-template-columns: repeat(2, 1fr) !important;
}

.home-section:not([class*="section-columns"]) .cards-grid--news {
    grid-template-columns: repeat(1, 1fr) !important;
}

/* ==========================================================================
   Desktop Responsive Adjustments
   Only apply these on large screens AFTER mobile rules
   Mobile rules above use max-width to override base.css
   ========================================================================== */

/* Desktop: Scale up columns only on very large screens */
/* Use same high specificity as mobile rules */
@media (min-width: 1400px) {
    body.home .homepage .home-section:not([class*="section-columns"]) .cards-grid--anime,
    body.home .homepage .home-section .cards-grid--anime,
    .homepage .home-section:not([class*="section-columns"]) .cards-grid--anime,
    .homepage .home-section .cards-grid--anime,
    .home-section:not([class*="section-columns"]) .cards-grid--anime,
    .home-section .cards-grid--anime {
        grid-template-columns: repeat(5, 1fr) !important;
    }
    body.home .homepage .home-section:not([class*="section-columns"]) .cards-grid--episode,
    body.home .homepage .home-section .cards-grid--episode,
    .homepage .home-section:not([class*="section-columns"]) .cards-grid--episode,
    .homepage .home-section .cards-grid--episode,
    .home-section:not([class*="section-columns"]) .cards-grid--episode,
    .home-section .cards-grid--episode {
        grid-template-columns: repeat(5, 1fr) !important;
    }
    body.home .homepage .home-section:not([class*="section-columns"]) .cards-grid--video,
    body.home .homepage .home-section .cards-grid--video,
    .homepage .home-section:not([class*="section-columns"]) .cards-grid--video,
    .homepage .home-section .cards-grid--video,
    .home-section:not([class*="section-columns"]) .cards-grid--video,
    .home-section .cards-grid--video {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    body.home .homepage .home-section:not([class*="section-columns"]) .cards-grid--news,
    body.home .homepage .home-section .cards-grid--news,
    .homepage .home-section:not([class*="section-columns"]) .cards-grid--news,
    .homepage .home-section .cards-grid--news,
    .home-section:not([class*="section-columns"]) .cards-grid--news,
    .home-section .cards-grid--news {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (min-width: 1600px) {
    body.home .homepage .home-section:not([class*="section-columns"]) .cards-grid--anime,
    body.home .homepage .home-section .cards-grid--anime,
    .homepage .home-section:not([class*="section-columns"]) .cards-grid--anime,
    .homepage .home-section .cards-grid--anime,
    .home-section:not([class*="section-columns"]) .cards-grid--anime,
    .home-section .cards-grid--anime {
        grid-template-columns: repeat(6, 1fr) !important;
    }
    body.home .homepage .home-section:not([class*="section-columns"]) .cards-grid--episode,
    body.home .homepage .home-section .cards-grid--episode,
    .homepage .home-section:not([class*="section-columns"]) .cards-grid--episode,
    .homepage .home-section .cards-grid--episode,
    .home-section:not([class*="section-columns"]) .cards-grid--episode,
    .home-section .cards-grid--episode {
        grid-template-columns: repeat(6, 1fr) !important;
    }
    body.home .homepage .home-section:not([class*="section-columns"]) .cards-grid--video,
    body.home .homepage .home-section .cards-grid--video,
    .homepage .home-section:not([class*="section-columns"]) .cards-grid--video,
    .homepage .home-section .cards-grid--video,
    .home-section:not([class*="section-columns"]) .cards-grid--video,
    .home-section .cards-grid--video {
        grid-template-columns: repeat(5, 1fr) !important;
    }
    body.home .homepage .home-section:not([class*="section-columns"]) .cards-grid--news,
    body.home .homepage .home-section .cards-grid--news,
    .homepage .home-section:not([class*="section-columns"]) .cards-grid--news,
    .homepage .home-section .cards-grid--news,
    .home-section:not([class*="section-columns"]) .cards-grid--news,
    .home-section .cards-grid--news {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* CRITICAL: Force 2 columns on all mobile screens - must override everything */
/* Use max-width queries to override min-width queries from base.css */
@media (max-width: 1399px) {
    /* Override base.css @media (min-width: 1400px) rule */
    body.home .homepage .home-section .cards-grid--anime,
    body.home .homepage .home-section .cards-grid--episode,
    body.home .homepage .home-section .cards-grid--video,
    body.home .home-section .cards-grid--anime,
    body.home .home-section .cards-grid--episode,
    body.home .home-section .cards-grid--video,
    .homepage .home-section .cards-grid--anime,
    .homepage .home-section .cards-grid--episode,
    .homepage .home-section .cards-grid--video,
    .home-section .cards-grid--anime,
    .home-section .cards-grid--episode,
    .home-section .cards-grid--video {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    body.home .homepage .home-section.section-columns-2 .cards-grid,
    body.home .homepage .home-section.section-columns-3 .cards-grid,
    body.home .homepage .home-section.section-columns-4 .cards-grid,
    body.home .homepage .home-section.section-columns-5 .cards-grid,
    body.home .homepage .home-section.section-columns-6 .cards-grid,
    body.home .home-section.section-columns-2 .cards-grid,
    body.home .home-section.section-columns-3 .cards-grid,
    body.home .home-section.section-columns-4 .cards-grid,
    body.home .home-section.section-columns-5 .cards-grid,
    body.home .home-section.section-columns-6 .cards-grid,
    .homepage .home-section.section-columns-2 .cards-grid,
    .homepage .home-section.section-columns-3 .cards-grid,
    .homepage .home-section.section-columns-4 .cards-grid,
    .homepage .home-section.section-columns-5 .cards-grid,
    .homepage .home-section.section-columns-6 .cards-grid,
    .home-section.section-columns-2 .cards-grid,
    .home-section.section-columns-3 .cards-grid,
    .home-section.section-columns-4 .cards-grid,
    .home-section.section-columns-5 .cards-grid,
    .home-section.section-columns-6 .cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 1199px) {
    /* Override base.css @media (min-width: 1200px) rule */
    body.home .homepage .home-section .cards-grid--anime,
    body.home .homepage .home-section .cards-grid--episode,
    body.home .homepage .home-section .cards-grid--video,
    body.home .home-section .cards-grid--anime,
    body.home .home-section .cards-grid--episode,
    body.home .home-section .cards-grid--video,
    .homepage .home-section .cards-grid--anime,
    .homepage .home-section .cards-grid--episode,
    .homepage .home-section .cards-grid--video,
    .home-section .cards-grid--anime,
    .home-section .cards-grid--episode,
    .home-section .cards-grid--video {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 767px) {
    /* Override base.css @media (min-width: 768px) rule */
    body.home .homepage .home-section .cards-grid--anime,
    body.home .homepage .home-section .cards-grid--episode,
    body.home .homepage .home-section .cards-grid--video,
    body.home .home-section .cards-grid--anime,
    body.home .home-section .cards-grid--episode,
    body.home .home-section .cards-grid--video,
    .homepage .home-section .cards-grid--anime,
    .homepage .home-section .cards-grid--episode,
    .homepage .home-section .cards-grid--video,
    .home-section .cards-grid--anime,
    .home-section .cards-grid--episode,
    .home-section .cards-grid--video {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Adjust gap for smaller screens */
@media (max-width: 480px) {
    .home-section .cards-grid--anime,
    .home-section .cards-grid--episode,
    .home-section .cards-grid--video {
        gap: 12px !important;
    }
    .home-section .cards-grid--news {
        gap: 15px !important;
    }
}

/* Ensure smaller gap on smallest phone screens (360px and below) */
@media (max-width: 360px) {
    .home-section .cards-grid--anime,
    .home-section .cards-grid--episode,
    .home-section .cards-grid--video {
        gap: 10px !important;
    }
    
    .home-section.section-columns-2 .cards-grid,
    .home-section.section-columns-3 .cards-grid,
    .home-section.section-columns-4 .cards-grid,
    .home-section.section-columns-5 .cards-grid,
    .home-section.section-columns-6 .cards-grid {
        gap: 10px !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;
    grid-auto-flow: row;
    grid-auto-columns: auto;
    overflow-x: visible;
}

.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;
    gap: 20px;
    width: 100%;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--animehub-border);
}

/* Ensure section header is consistent across all sections */
.home-section .section-header {
    margin-bottom: 25px;
}

.homepage-group .home-section .section-header {
    margin-bottom: 25px;
}

.section-header__left {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Legacy support for section-header__content */
.section-header__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    position: relative;
    padding-left: 15px;
    margin-bottom: 0;
    margin-top: 0;
    display: inline-block;
    line-height: 1.3;
    color: var(--animehub-text);
}

/* Ensure section title is consistent across all sections */
.home-section .section-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: var(--animehub-primary);
    border-radius: 2px;
}

/* Section Description */
.section-description {
    font-size: 13px;
    font-weight: 400;
    color: var(--animehub-text-secondary);
    line-height: 1.5;
    margin: 0;
    padding-left: 15px;
}

/* Legacy support with !important for backwards compatibility */
p.section-description,
.section-header .section-description,
.section-header__content .section-description,
.section-header__left .section-description {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: var(--animehub-text-secondary);
    line-height: 1.5;
    margin: 0;
    padding-left: 15px;
}

.section-link {
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--animehub-text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--animehub-bg-secondary);
    border: 1px solid var(--animehub-border);
    border-radius: 6px;
    transition: all var(--animehub-transition);
    text-decoration: none;
    white-space: nowrap;
}

.section-link:hover {
    color: var(--animehub-primary);
    border-color: var(--animehub-primary);
    background: rgba(255, 107, 53, 0.1);
}

.section-link svg {
    width: 16px;
    height: 16px;
    transition: transform var(--animehub-transition);
}

.section-link:hover svg {
    transform: translateX(3px);
}

/* ==========================================================================
   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;
    }

    .hero-slide__content {
        padding-left: var(--animehub-gap, 20px);
        padding-right: var(--animehub-gap, 20px);
    }

    .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__content {
        align-items: flex-start;
        padding-top: 30px;
        padding-bottom: 80px; /* Tạo không gian cho dots navigation */
        padding-left: var(--animehub-gap, 16px);
        padding-right: var(--animehub-gap, 16px);
    }

    .hero-slide__wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        width: 100%;
    }

    .hero-slide__poster {
        width: 160px;
        align-self: center;
    }

    .hero-slide__info {
        width: 100%;
        max-width: 100%;
        padding-right: var(--animehub-gap);
        min-width: 0;
        overflow: hidden; /* Đảm bảo nội dung không tràn ra ngoài */
    }

    .hero-slide__title {
        font-size: 28px;
        line-height: 1.3;
        margin-bottom: 12px;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        max-height: calc(28px * 1.3 * 3); /* 3 dòng */
    }

    .hero-slide__excerpt {
        display: none;
    }

    .hero-slide__actions {
        flex-direction: column;
        gap: 12px;
        margin-top: 20px;
    }

    .hero-slide__actions .btn {
        width: 100%;
    }

    /* Di chuyển dots xuống dưới cùng và làm nhỏ hơn */
    .hero-controls {
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
    }

    .hero-dots {
        gap: 8px;
        padding: 8px 14px;
        background: rgba(0, 0, 0, 0.5);
    }

    .hero-dot {
        width: 8px;
        height: 8px;
    }

    .hero-dot.active {
        width: 24px;
        height: 8px;
    }

    .hero-prev,
    .hero-next {
        width: 48px;
        height: 48px;
    }

    .hero-prev {
        left: 20px;
    }

    .hero-next {
        right: 20px;
    }

    .hero-prev svg,
    .hero-next svg {
        width: 22px;
        height: 22px;
    }

    .section-title {
        font-size: 20px;
    }
    
    /* Ensure consistent section spacing on mobile */
    .home-section {
        margin: 40px 0;
    }
    
    .homepage-group .home-section {
        margin-bottom: 40px;
    }

    .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__content {
        padding-top: 25px;
        padding-bottom: 70px; /* Tạo không gian cho dots trên màn hình nhỏ */
        padding-left: var(--animehub-gap, 12px);
        padding-right: var(--animehub-gap, 12px);
    }

    .hero-slide__wrapper {
        gap: 15px;
    }

    .hero-slide__poster {
        width: 140px;
    }

    .hero-slide__title {
        font-size: 22px;
        line-height: 1.3;
        margin-bottom: 10px;
        -webkit-line-clamp: 2; /* Chỉ hiển thị 2 dòng trên màn hình rất nhỏ */
        max-height: calc(22px * 1.3 * 2);
    }

    .hero-slide__badges {
        margin-bottom: 12px;
    }

    .hero-slide__genres {
        font-size: 12px;
        margin-bottom: 12px;
    }

    .hero-slide__actions {
        gap: 10px;
        margin-top: 15px;
    }

    .hero-slide__actions .btn {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 14px;
    }

    /* Dots nhỏ hơn trên màn hình rất nhỏ */
    .hero-controls {
        bottom: 12px;
    }

    .hero-dots {
        gap: 6px;
        padding: 6px 12px;
    }

    .hero-dot {
        width: 6px;
        height: 6px;
    }

    .hero-dot.active {
        width: 20px;
        height: 6px;
    }

    .hero-prev,
    .hero-next {
        width: 44px;
        height: 44px;
    }

    .hero-prev {
        left: 12px;
    }

    .hero-next {
        right: 12px;
    }

    .hero-prev svg,
    .hero-next svg {
        width: 20px;
        height: 20px;
    }

    .ranking-item__poster {
        width: 40px;
        height: 56px;
    }
}

/* ==========================================================================
   Homepage Groups
   ========================================================================== */

.homepage-group {
    position: relative;
    margin: 40px 0;
    padding: 30px;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* First homepage group after hero */
.homepage > .container > .homepage-group:first-child {
    margin-top: 40px;
}

.homepage-group::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.03;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 0;
}

.homepage-group > * {
    position: relative;
    z-index: 1;
}

/* Group Header Badge */
.homepage-group__header {
    display: none !important; /* Hidden per user request */
    align-items: center;
    gap: 15px;
    margin-bottom: 40px;
}

.homepage-group__badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.homepage-group__badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.homepage-group__badge-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Anime Group */
.homepage-group--anime {
    background: linear-gradient(135deg, 
        rgba(139, 69, 19, 0.08) 0%, 
        rgba(160, 82, 45, 0.05) 50%,
        rgba(139, 69, 19, 0.08) 100%);
    border: 1px solid rgba(139, 69, 19, 0.15);
    box-shadow: 0 8px 32px rgba(139, 69, 19, 0.1);
}

.homepage-group--anime::before {
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(139, 69, 19, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(160, 82, 45, 0.1) 0%, transparent 50%);
}

.homepage-group--anime .homepage-group__badge {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.2), rgba(160, 82, 45, 0.15));
    border-color: rgba(139, 69, 19, 0.3);
    color: #8B4513;
}

.homepage-group--anime .section-title {
    color: #8B4513;
}

.homepage-group--anime .section-title::before {
    background: linear-gradient(135deg, #8B4513, #A0522D);
    box-shadow: 0 0 10px rgba(139, 69, 19, 0.3);
}

.homepage-group--anime .home-section {
    margin-bottom: 40px;
    padding: 0;
}

.homepage-group--anime .home-section:last-child {
    margin-bottom: 0;
}

/* Episode Group */
.homepage-group--episode {
    background: linear-gradient(135deg, 
        rgba(70, 130, 180, 0.08) 0%, 
        rgba(100, 149, 237, 0.05) 50%,
        rgba(70, 130, 180, 0.08) 100%);
    border: 1px solid rgba(70, 130, 180, 0.15);
    box-shadow: 0 8px 32px rgba(70, 130, 180, 0.1);
}

.homepage-group--episode::before {
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(70, 130, 180, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(100, 149, 237, 0.1) 0%, transparent 50%);
}

.homepage-group--episode .homepage-group__badge {
    background: linear-gradient(135deg, rgba(70, 130, 180, 0.2), rgba(100, 149, 237, 0.15));
    border-color: rgba(70, 130, 180, 0.3);
    color: #4682B4;
}

.homepage-group--episode .section-title {
    color: #4682B4;
}

.homepage-group--episode .section-title::before {
    background: linear-gradient(135deg, #4682B4, #6495ED);
    box-shadow: 0 0 10px rgba(70, 130, 180, 0.3);
}

.homepage-group--episode .home-section {
    margin-bottom: 40px;
    padding: 0;
}

.homepage-group--episode .home-section:last-child {
    margin-bottom: 0;
}

/* Video Group */
.homepage-group--video {
    background: linear-gradient(135deg, 
        rgba(220, 20, 60, 0.08) 0%, 
        rgba(255, 69, 0, 0.05) 50%,
        rgba(220, 20, 60, 0.08) 100%);
    border: 1px solid rgba(220, 20, 60, 0.15);
    box-shadow: 0 8px 32px rgba(220, 20, 60, 0.1);
}

.homepage-group--video::before {
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(220, 20, 60, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 69, 0, 0.1) 0%, transparent 50%);
}

.homepage-group--video .homepage-group__badge {
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.2), rgba(255, 69, 0, 0.15));
    border-color: rgba(220, 20, 60, 0.3);
    color: #DC143C;
}

.homepage-group--video .section-title {
    color: #DC143C;
}

.homepage-group--video .section-title::before {
    background: linear-gradient(135deg, #DC143C, #FF4500);
    box-shadow: 0 0 10px rgba(220, 20, 60, 0.3);
}

.homepage-group--video .home-section {
    margin-bottom: 40px;
    padding: 0;
}

.homepage-group--video .home-section:last-child {
    margin-bottom: 0;
}

/* News Group */
.homepage-group--news {
    background: linear-gradient(135deg, 
        rgba(34, 139, 34, 0.08) 0%, 
        rgba(50, 205, 50, 0.05) 50%,
        rgba(34, 139, 34, 0.08) 100%);
    border: 1px solid rgba(34, 139, 34, 0.15);
    box-shadow: 0 8px 32px rgba(34, 139, 34, 0.1);
}

.homepage-group--news::before {
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(34, 139, 34, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(50, 205, 50, 0.1) 0%, transparent 50%);
}

.homepage-group--news .homepage-group__badge {
    background: linear-gradient(135deg, rgba(34, 139, 34, 0.2), rgba(50, 205, 50, 0.15));
    border-color: rgba(34, 139, 34, 0.3);
    color: #228B22;
}

.homepage-group--news .section-title {
    color: #228B22;
}

.homepage-group--news .section-title::before {
    background: linear-gradient(135deg, #228B22, #32CD32);
    box-shadow: 0 0 10px rgba(34, 139, 34, 0.3);
}

.homepage-group--news .home-section {
    margin-bottom: 40px;
    padding: 0;
}

.homepage-group--news .home-section:last-child {
    margin-bottom: 0;
}

/* Group Animations */
@keyframes groupFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.homepage-group {
    animation: groupFadeIn 0.6s ease-out;
}

.homepage-group .home-section {
    animation: groupFadeIn 0.6s ease-out;
    animation-fill-mode: both;
}

.homepage-group .home-section:nth-child(1) {
    animation-delay: 0.1s;
}

.homepage-group .home-section:nth-child(2) {
    animation-delay: 0.2s;
}

.homepage-group .home-section:nth-child(3) {
    animation-delay: 0.3s;
}

.homepage-group .home-section:nth-child(4) {
    animation-delay: 0.4s;
}

/* Group Hover Effects - Disabled for cleaner look */
/*
.homepage-group:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}
*/

/* Media Info Badges in Groups */
.homepage-group .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.homepage-group--anime .badge {
    background: rgba(139, 69, 19, 0.15);
    color: #8B4513;
    border: 1px solid rgba(139, 69, 19, 0.2);
}

.homepage-group--episode .badge {
    background: rgba(70, 130, 180, 0.15);
    color: #4682B4;
    border: 1px solid rgba(70, 130, 180, 0.2);
}

.homepage-group--video .badge {
    background: rgba(220, 20, 60, 0.15);
    color: #DC143C;
    border: 1px solid rgba(220, 20, 60, 0.2);
}

.homepage-group--news .badge {
    background: rgba(34, 139, 34, 0.15);
    color: #228B22;
    border: 1px solid rgba(34, 139, 34, 0.2);
}

/* Responsive Groups */
@media (max-width: 1024px) {
    .homepage-group {
        margin: 30px 0;
        padding: 25px;
    }
    
    .homepage-group .home-section {
        margin-bottom: 30px;
    }
}

@media (max-width: 768px) {
    .homepage-group {
        margin: 20px 0;
        padding: 20px 15px;
        border-radius: 12px;
    }
    
    .homepage-group .home-section {
        margin-bottom: 25px;
    }
    
    .homepage-group .section-title {
        font-size: 18px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .section-link {
        align-self: flex-start;
    }
}

@media (max-width: 480px) {
    .homepage-group {
        margin: 15px 0;
        padding: 15px 12px;
        border-radius: 10px;
    }
    
    .homepage-group .home-section {
        margin-bottom: 20px;
    }
    
    .section-title {
        font-size: 16px;
    }
    
    .section-description {
        font-size: 12px;
    }
    
    .section-link {
        font-size: 13px;
        padding: 6px 12px;
    }
}

/* ==========================================================================
   FINAL OVERRIDE: Mobile responsive fix - Must be at the end of file
   This ensures mobile ALWAYS shows 2 columns, overriding ALL other rules
   ========================================================================== */

/* Override base.css and any other desktop rules for mobile screens */
@media (max-width: 1399px) {
    /* Highest possible specificity to override everything */
    body .site-main.homepage .container .home-section .cards-grid--anime,
    body .site-main.homepage .home-section .cards-grid--anime,
    body .homepage .home-section .cards-grid--anime,
    .site-main.homepage .container .home-section .cards-grid--anime,
    .site-main.homepage .home-section .cards-grid--anime,
    .homepage .container .home-section .cards-grid--anime,
    .homepage .home-section .cards-grid--anime,
    .home-section .cards-grid--anime {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    body .site-main.homepage .container .home-section .cards-grid--episode,
    body .site-main.homepage .home-section .cards-grid--episode,
    body .homepage .home-section .cards-grid--episode,
    .site-main.homepage .container .home-section .cards-grid--episode,
    .site-main.homepage .home-section .cards-grid--episode,
    .homepage .container .home-section .cards-grid--episode,
    .homepage .home-section .cards-grid--episode,
    .home-section .cards-grid--episode {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    body .site-main.homepage .container .home-section .cards-grid--video,
    body .site-main.homepage .home-section .cards-grid--video,
    body .homepage .home-section .cards-grid--video,
    .site-main.homepage .container .home-section .cards-grid--video,
    .site-main.homepage .home-section .cards-grid--video,
    .homepage .container .home-section .cards-grid--video,
    .homepage .home-section .cards-grid--video,
    .home-section .cards-grid--video {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Override section-columns rules */
    body .site-main.homepage .container .home-section.section-columns-2 .cards-grid,
    body .site-main.homepage .container .home-section.section-columns-3 .cards-grid,
    body .site-main.homepage .container .home-section.section-columns-4 .cards-grid,
    body .site-main.homepage .container .home-section.section-columns-5 .cards-grid,
    body .site-main.homepage .container .home-section.section-columns-6 .cards-grid,
    body .site-main.homepage .home-section.section-columns-2 .cards-grid,
    body .site-main.homepage .home-section.section-columns-3 .cards-grid,
    body .site-main.homepage .home-section.section-columns-4 .cards-grid,
    body .site-main.homepage .home-section.section-columns-5 .cards-grid,
    body .site-main.homepage .home-section.section-columns-6 .cards-grid,
    body .homepage .home-section.section-columns-2 .cards-grid,
    body .homepage .home-section.section-columns-3 .cards-grid,
    body .homepage .home-section.section-columns-4 .cards-grid,
    body .homepage .home-section.section-columns-5 .cards-grid,
    body .homepage .home-section.section-columns-6 .cards-grid,
    .site-main.homepage .container .home-section.section-columns-2 .cards-grid,
    .site-main.homepage .container .home-section.section-columns-3 .cards-grid,
    .site-main.homepage .container .home-section.section-columns-4 .cards-grid,
    .site-main.homepage .container .home-section.section-columns-5 .cards-grid,
    .site-main.homepage .container .home-section.section-columns-6 .cards-grid,
    .site-main.homepage .home-section.section-columns-2 .cards-grid,
    .site-main.homepage .home-section.section-columns-3 .cards-grid,
    .site-main.homepage .home-section.section-columns-4 .cards-grid,
    .site-main.homepage .home-section.section-columns-5 .cards-grid,
    .site-main.homepage .home-section.section-columns-6 .cards-grid,
    .homepage .container .home-section.section-columns-2 .cards-grid,
    .homepage .container .home-section.section-columns-3 .cards-grid,
    .homepage .container .home-section.section-columns-4 .cards-grid,
    .homepage .container .home-section.section-columns-5 .cards-grid,
    .homepage .container .home-section.section-columns-6 .cards-grid,
    .homepage .home-section.section-columns-2 .cards-grid,
    .homepage .home-section.section-columns-3 .cards-grid,
    .homepage .home-section.section-columns-4 .cards-grid,
    .homepage .home-section.section-columns-5 .cards-grid,
    .homepage .home-section.section-columns-6 .cards-grid,
    .home-section.section-columns-2 .cards-grid,
    .home-section.section-columns-3 .cards-grid,
    .home-section.section-columns-4 .cards-grid,
    .home-section.section-columns-5 .cards-grid,
    .home-section.section-columns-6 .cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ==========================================================================
   ABSOLUTE FINAL OVERRIDE - MUST BE LAST IN FILE
   Maximum specificity to override ALL other rules including base.css
   ========================================================================== */
@media screen and (max-width: 1399px) {
    html body .site-main.homepage .home-section .cards-grid--anime,
    html body .site-main.homepage .home-section .cards-grid--episode,
    html body .site-main.homepage .home-section .cards-grid--video,
    html body .homepage .home-section .cards-grid--anime,
    html body .homepage .home-section .cards-grid--episode,
    html body .homepage .home-section .cards-grid--video {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    html body .site-main.homepage .home-section.section-columns-6 .cards-grid,
    html body .homepage .home-section.section-columns-6 .cards-grid,
    html body .homepage .home-section.section-columns-5 .cards-grid,
    html body .homepage .home-section.section-columns-4 .cards-grid,
    html body .homepage .home-section.section-columns-3 .cards-grid,
    html body .homepage .home-section.section-columns-2 .cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
