/* Enhanced Movie Slider Component Styles */
.movie-slider-section {
    @apply bg-theme-primary py-8 lg:py-12;
    position: relative;
    overflow: hidden;
}

.movie-slider-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-primary) 100%);
    opacity: 0.5;
    z-index: 0;
}

.movie-slider-section > * {
    position: relative;
    z-index: 1;
}

.movie-slider-header {
    @apply flex items-center justify-between mb-8;
}

.movie-slider-title {
    @apply text-xl lg:text-2xl font-bold text-theme-primary flex items-center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.movie-slider-title span {
    background: linear-gradient(135deg, var(--main-color) 0%, #16a34a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.movie-slider-title .arrow-icon {
    @apply ml-3 text-theme-tertiary transition-all duration-300;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.movie-slider-title:hover .arrow-icon {
    @apply text-main transform translate-x-1;
}

.movie-swiper {
    @apply relative;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 24px 0 32px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative !important;
    min-height: 450px !important; /* Ensure container accommodates full movie cards */
    margin: 0 50px;
    overflow: visible;
}

.movie-swiper .swiper-wrapper {
    display: flex !important;
    align-items: stretch !important;
    height: auto !important;
    padding: 0 16px;
    /* Force minimum height to accommodate movie cards */
    min-height: 420px !important;
}

.movie-swiper .swiper-slide {
    flex-shrink: 0 !important;
    height: auto !important;
    display: flex !important;
    align-items: stretch !important;
    padding-right: 12px;
    /* Ensure slides can accommodate full movie card content */
    min-height: 420px !important;
}

.movie-swiper .swiper-slide:last-child {
    padding-right: 0;
}

/* Ensure slides don't exceed container */
.movie-swiper .swiper-slide.movie-slider-item {
    box-sizing: border-box;
}

/* Loading Skeleton Styles */
.movie-slider-skeleton {
    padding: 24px 16px;
    overflow: hidden;
}

.movie-slider-skeleton .animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* FIXED: Movie Slider Item - Consolidated sizing without conflicts */
.movie-slider-item {
    width: 160px !important; /* Base mobile size */
    flex-shrink: 0;
    box-sizing: border-box;
}

@media (min-width: 480px) {
    .movie-slider-item {
        width: 170px !important;
    }
}

@media (min-width: 640px) {
    .movie-slider-item {
        width: 180px !important;
    }
}

@media (min-width: 768px) {
    .movie-slider-item {
        width: 190px !important;
    }
}

@media (min-width: 1024px) {
    .movie-slider-item {
        width: 200px !important;
    }
}

@media (min-width: 1280px) {
    .movie-slider-item {
        width: 220px !important;
    }
}

@media (min-width: 1536px) {
    .movie-slider-item {
        width: 240px !important;
    }
}

/* CONTAINER-LEVEL: Slider item fills slide and stretches */
.movie-slider-item {
    width: 100%;
    height: 100% !important; /* Fill the slide container */
    display: flex !important;
    flex-direction: column !important;
    min-height: 420px !important; /* Ensure enough space for movie card */
}

/* FORCE FULL HEIGHT: Movie card must show all content */
.movie-swiper .swiper-slide.movie-slider-item .movie-card {
    height: 100% !important; /* Fill the slider item container */
    display: flex !important;
    flex-direction: column !important;
    min-height: 400px !important; /* Ensure movie card shows all content */
    max-height: none !important; /* Remove any height constraints */
}

/* ENSURE MOVIE CARD CONTENT DISTRIBUTION */
.movie-swiper .swiper-slide.movie-slider-item .movie-card .flex-1 {
    flex: 1 !important; /* Ensure flex-1 elements expand properly */
}

.movie-swiper .swiper-slide.movie-slider-item .movie-card > * {
    flex-shrink: 0; /* Prevent content from shrinking */
}

/* ===== NEW LAYOUT: TOP NAVIGATION CONTROLS ===== */
.movie-slider-nav-top {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px; /* Increased from 12px for better touch targets */
    margin-bottom: 16px;
    padding: 0 16px;
    min-height: 48px;
    width: 100%;
    box-sizing: border-box;
}

/* ===== NEW LAYOUT: BOTTOM PAGINATION CONTROLS ===== */
.movie-slider-pagination-bottom {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 24px;
    padding: 0 16px;
    min-height: 32px;
    width: 100%;
    box-sizing: border-box;
}

/* ===== OPTIMIZED NAVIGATION BUTTONS (TOP RIGHT POSITIONING) ===== */
.movie-slider-nav-top .swiper-button-next,
.movie-slider-nav-top .swiper-button-prev,
.movie-slider-nav-top .movie-nav-btn {
    /* Modern Glassmorphism Design */
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;

    /* Enhanced Visual Design */
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);

    /* Static positioning for top layout */
    position: relative;
    z-index: 20;

    /* Enhanced Interactions */
    cursor: pointer;
    opacity: 1;
    visibility: visible;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Accessibility */
    outline: none;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
}

/* Remove default Swiper button content (TOP NAVIGATION) */
.movie-slider-nav-top .swiper-button-next::after,
.movie-slider-nav-top .swiper-button-prev::after {
    display: none;
}

/* Enhanced Button Icons (TOP NAVIGATION) */
.movie-slider-nav-top .movie-nav-btn i {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== ENHANCED HOVER STATES (TOP NAVIGATION) ===== */
.movie-slider-nav-top .swiper-button-next:hover,
.movie-slider-nav-top .swiper-button-prev:hover,
.movie-slider-nav-top .movie-nav-btn:hover {
    /* Glassmorphism Enhancement */
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 0 1px var(--main-color);

    /* Smooth Transform */
    transform: scale(1.05);
    opacity: 1;
}

.movie-slider-nav-top .movie-nav-btn:hover i {
    color: var(--main-color);
    transform: scale(1.1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

/* ===== ENHANCED FOCUS STATES (TOP NAVIGATION) ===== */
.movie-slider-nav-top .swiper-button-next:focus,
.movie-slider-nav-top .swiper-button-prev:focus,
.movie-slider-nav-top .movie-nav-btn:focus {
    outline: 3px solid var(--main-color);
    outline-offset: 4px;
    opacity: 1;
    visibility: visible;
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--main-color);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1),
    0 0 0 5px rgba(var(--main-color-rgb), 0.3),
    0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ===== ENHANCED PAGINATION DESIGN (BOTTOM CENTER) ===== */
.movie-slider-pagination-bottom .swiper-pagination,
.movie-slider-pagination-bottom .movie-pagination {
    display: flex !important;
    justify-content: center;
    align-items: center;
    position: relative !important;
    gap: 8px;
    margin: 0;
    min-height: 20px; /* Ensure consistent height even with no bullets */
    overflow: visible; /* Allow bullets to be visible */
    width: 100%;
    z-index: 10;
    /* DEBUG: Temporary border to see container */
    /* border: 1px solid red; */
}

/* Modern Pagination Bullets (BOTTOM CENTER) */
.movie-slider-pagination-bottom .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    opacity: 1 !important;
    margin: 0 4px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: inline-block !important;

    /* Touch Targets */
    position: relative;
}

/* Enhanced Hover States */
.movie-slider-pagination-bottom .swiper-pagination-bullet:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.2);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Active State with Pill Design */
.movie-slider-pagination-bottom .swiper-pagination-bullet-active {
    width: 24px;
    height: 8px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--main-color) 0%, #16a34a 100%);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 16px rgba(var(--main-color-rgb), 0.4),
    0 2px 8px rgba(0, 0, 0, 0.2);
    transform: scale(1);
}

/* FIXED: Enhanced Responsive Design without conflicts */
@media (max-width: 640px) {
    .movie-slider-item {
        width: 140px !important;
    }

    .movie-slider-title {
        @apply text-base;
    }

    /* ===== MOBILE-OPTIMIZED NAVIGATION (TOP RIGHT) ===== */
    .movie-slider-nav-top .swiper-button-next,
    .movie-slider-nav-top .swiper-button-prev,
    .movie-slider-nav-top .movie-nav-btn {
        /* Smaller buttons on mobile */
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    .movie-slider-nav-top .movie-nav-btn i {
        font-size: 12px;
    }

    /* Adjust top navigation container on mobile */
    .movie-slider-nav-top {
        margin-bottom: 12px;
        padding: 0 8px;
        gap: 16px; /* Increased from 8px for better mobile touch targets */
        min-height: 40px;
    }

    /* Adjust bottom pagination container on mobile */
    .movie-slider-pagination-bottom {
        margin-top: 16px;
        padding: 0 8px;
        min-height: 24px;
    }

    /* Adjust swiper container on mobile */
    .movie-swiper {
        padding: 16px 0 20px 0;
        margin: 0 16px; /* Reduced margin since buttons are now below */
    }

    /* FORCE MOBILE HEIGHT: Ensure movie card shows all content on mobile */
    .movie-swiper .swiper-slide.movie-slider-item .movie-card {
        height: 100% !important;
        min-height: 380px !important; /* Accommodate mobile movie card content */
        max-height: none !important;
    }

    .movie-swiper .swiper-wrapper {
        min-height: 400px !important; /* Mobile wrapper height */
    }

    .movie-swiper .swiper-slide {
        min-height: 400px !important; /* Mobile slide height */
    }

    .movie-slider-item {
        min-height: 400px !important; /* Mobile item height */
    }

    /* ===== MOBILE-OPTIMIZED PAGINATION (BOTTOM CENTER) ===== */
    .movie-slider-pagination-bottom .swiper-pagination-bullet {
        width: 6px;
        height: 6px;
    }

    .movie-slider-pagination-bottom .swiper-pagination-bullet-active {
        width: 18px;
        height: 6px;
        border-radius: 8px;
    }

    /* Enhanced touch targets for mobile */
    .movie-slider-pagination-bottom .swiper-pagination-bullet::before {
        content: '';
        position: absolute;
        top: -8px;
        left: -8px;
        right: -8px;
        bottom: -8px;
        border-radius: 50%;
    }
}

/* FIXED: Very small screens without overlapping breakpoints */
@media (max-width: 479px) {
    .movie-slider-item {
        width: 130px !important; /* Optimized for very small screens */
    }

    .movie-slider-section {
        @apply py-4;
    }

    /* Reduce swiper container on very small screens */
    .movie-swiper {
        padding: 12px 0 20px 0;
        margin: 0 12px;
    }
}

/* OVERRIDE SWIPER DEFAULTS: Force full content visibility */
.movie-swiper .swiper-wrapper .swiper-slide.movie-slider-item .movie-card {
    height: 100% !important; /* Fill the slider item container */
    display: flex !important;
    flex-direction: column !important;
    min-height: 400px !important; /* Ensure all content is visible */
    max-height: none !important; /* Remove any height constraints */
    overflow: visible !important; /* Ensure content is not clipped */
}

/* ADDITIONAL SWIPER OVERRIDES */
.movie-swiper .swiper-wrapper .swiper-slide {
    height: auto !important;
    min-height: 420px !important;
}

.movie-swiper .swiper-wrapper .swiper-slide.movie-slider-item {
    height: auto !important;
    min-height: 420px !important;
}

/* ALTERNATIVE APPROACH: CSS Grid for more predictable layout */
.movie-swiper .swiper-wrapper {
    /* Alternative: Use CSS Grid instead of flexbox */
    /* display: grid !important; */
    /* grid-auto-flow: column !important; */
    /* grid-auto-columns: var(--slide-width, 200px) !important; */
    /* align-items: stretch !important; */
}

/* DEBUG: Temporary borders to see container boundaries (remove after testing) */
.movie-swiper .swiper-slide {
    /* border: 2px solid red !important; */
}

.movie-slider-item {
    /* border: 2px solid blue !important; */
}

.movie-swiper .swiper-slide.movie-slider-item .movie-card {
    /* border: 2px solid green !important; */
}

/* Loading States and Animations */
.movie-swiper.slider-loading {
    opacity: 0.7;
    pointer-events: none;
}

.movie-swiper.slider-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(0, 255, 102, 0.3);
    border-top: 3px solid var(--main-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 100;
}

.movie-swiper.slider-loaded {
    opacity: 1;
    transition: opacity 0.5s ease;
}

.movie-swiper.slider-visible {
    animation: slideInUp 0.6s ease-out;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== VISIBILITY CONTROLS (TWO-LEVEL LAYOUT) ===== */
/* Navigation buttons are always visible in top-right position */
.movie-slider-nav-top .swiper-button-next,
.movie-slider-nav-top .swiper-button-prev,
.movie-slider-nav-top .movie-nav-btn {
    opacity: 1;
    visibility: visible;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== DISABLED STATES (TWO-LEVEL LAYOUT) ===== */
.movie-slider-nav-top .swiper-button-disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: none !important;
}

.movie-slider-nav-top .swiper-button-disabled i {
    color: rgba(255, 255, 255, 0.4) !important;
}

/* Enhanced focus/active states for accessibility */
.movie-slider-nav-top .swiper-button-next:focus,
.movie-slider-nav-top .swiper-button-prev:focus,
.movie-slider-nav-top .movie-nav-btn:focus,
.movie-slider-nav-top .swiper-button-next:active,
.movie-slider-nav-top .swiper-button-prev:active,
.movie-slider-nav-top .movie-nav-btn:active {
    opacity: 1 !important;
    visibility: visible !important;
}

/* ===== TABLET OPTIMIZATIONS (TWO-LEVEL LAYOUT) ===== */
@media (min-width: 641px) and (max-width: 1024px) {
    .movie-slider-nav-top .swiper-button-next,
    .movie-slider-nav-top .swiper-button-prev,
    .movie-slider-nav-top .movie-nav-btn {
        width: 42px;
        height: 42px;
        min-width: 42px;
        min-height: 42px;
    }

    .movie-slider-nav-top {
        margin-bottom: 14px;
        padding: 0 12px;
        gap: 18px; /* Increased from 10px for better tablet touch targets */
        min-height: 44px;
    }

    .movie-slider-pagination-bottom {
        margin-top: 20px;
        padding: 0 12px;
        min-height: 28px;
    }

    .movie-swiper {
        margin: 0 16px;
    }

    .movie-slider-pagination-bottom .swiper-pagination-bullet {
        width: 7px;
        height: 7px;
    }

    .movie-slider-pagination-bottom .swiper-pagination-bullet-active {
        width: 20px;
        height: 7px;
    }
}

/* ===== DESKTOP ENHANCEMENTS (TWO-LEVEL LAYOUT) ===== */
@media (min-width: 1025px) {
    .movie-slider-nav-top .swiper-button-next,
    .movie-slider-nav-top .swiper-button-prev,
    .movie-slider-nav-top .movie-nav-btn {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
    }

    .movie-slider-nav-top .movie-nav-btn i {
        font-size: 16px;
    }

    .movie-slider-nav-top {
        margin-bottom: 18px;
        padding: 0 20px;
        gap: 24px; /* Increased from 14px for better desktop spacing */
        min-height: 50px;
    }

    .movie-slider-pagination-bottom {
        margin-top: 28px;
        padding: 0 20px;
        min-height: 32px;
    }
}
