/**
 * Fix Empty Content Cards CSS
 * Ensures all movie and series cards are visible and properly displayed
 */

/* ===== FORCE VISIBILITY FOR ALL CARDS ===== */
.content-card {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 300px !important;
}

/* ===== POSTER CONTAINER ===== */
.content-poster {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    aspect-ratio: 2/3 !important;
    background: rgba(20, 20, 20, 0.5) !important;
    border-radius: 0.75rem !important;
    overflow: hidden !important;
    margin-bottom: 0.75rem !important;
}

/* ===== IMAGE HANDLING ===== */
.content-poster img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: opacity 0.3s ease, transform 0.7s ease !important;
}

/* Image loading state */
.content-poster img[loading="lazy"] {
    opacity: 0;
    animation: fadeInImage 0.5s ease forwards;
}

@keyframes fadeInImage {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== PLACEHOLDER FOR MISSING IMAGES ===== */
.content-poster .placeholder-icon {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 1 !important;
    font-size: 3rem !important;
    color: rgba(255, 255, 255, 0.3) !important;
    pointer-events: none !important;
}

/* Placeholder background when image fails */
.content-poster:has(.placeholder-icon) {
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.2) 0%, rgba(20, 20, 20, 0.9) 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ===== CARD CONTENT ===== */
.content-title {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding: 0 0.25rem !important;
    margin-bottom: 0.25rem !important;
}

.content-year {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    font-size: 0.8rem !important;
    color: var(--muted-foreground) !important;
    padding: 0 0.25rem !important;
}

/* ===== BADGES AND OVERLAYS ===== */
.content-rating,
.content-badge {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 2 !important;
}

.content-overlay {
    display: flex !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

.content-card:hover .content-overlay {
    opacity: 1 !important;
}

/* ===== SCROLL CONTAINER ===== */
.content-scroll {
    display: flex !important;
    gap: 1rem !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding-bottom: 1rem !important;
    scroll-snap-type: x mandatory !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Hide scrollbar but keep functionality */
.content-scroll::-webkit-scrollbar {
    display: none !important;
}

.content-scroll {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (min-width: 640px) {
    .content-card {
        min-height: 320px !important;
    }
    
    .content-title {
        font-size: 0.95rem !important;
    }
    
    .content-year {
        font-size: 0.85rem !important;
    }
}

@media (min-width: 1024px) {
    .content-card {
        min-height: 360px !important;
    }
    
    .content-title {
        font-size: 1rem !important;
    }
    
    .content-year {
        font-size: 0.9rem !important;
    }
    
    .content-scroll {
        gap: 1.25rem !important;
    }
}

/* ===== VIDEO CARDS (Sports) ===== */
.content-card.video {
    min-height: 200px !important;
}

.content-card.video .content-poster {
    aspect-ratio: 16/9 !important;
}

@media (min-width: 640px) {
    .content-card.video {
        min-height: 220px !important;
    }
}

@media (min-width: 1024px) {
    .content-card.video {
        min-height: 250px !important;
    }
}

/* ===== LOADING STATE ===== */
.content-card.loading {
    opacity: 0.6 !important;
}

.content-card.loading .content-poster {
    background: linear-gradient(
        90deg,
        rgba(20, 20, 20, 0.5) 0%,
        rgba(40, 40, 40, 0.5) 50%,
        rgba(20, 20, 20, 0.5) 100%
    ) !important;
    background-size: 200% 100% !important;
    animation: shimmer 1.5s infinite !important;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ===== ERROR STATE ===== */
.content-card.error .content-poster {
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.1) 0%, rgba(20, 20, 20, 0.8) 100%) !important;
    border: 1px solid rgba(255, 0, 0, 0.2) !important;
}

/* ===== ACCESSIBILITY ===== */
.content-card:focus-visible {
    outline: 2px solid var(--primary) !important;
    outline-offset: 2px !important;
}

.content-poster img[alt=""] {
    /* Ensure alt text is present for accessibility */
    content: attr(data-title) !important;
}

/* ===== PRINT STYLES ===== */
@media print {
    .content-card {
        page-break-inside: avoid !important;
    }
}
