/* =========================================
   HOT MARQUEE SECTION (Infinite Scroll)
   ========================================= */

:root {
    --hot-card-width: 180px;
    --hot-gap: 30px;
    --hot-mobile-width: 140px;
    --hot-mobile-gap: 15px;
    --hot-accent: #ff5500;
}

.legendary-hot-section {
    position: relative;
    padding: 40px 0;
    margin-bottom: 50px;
    overflow: hidden;
    background: transparent;
    direction: ltr;
    /* Important for marquee calculation */
}

/* Header */
.hot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    padding: 0 40px;
    direction: rtl;
    /* Build header RTL */
}

.hot-title-box {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hot-icon {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #ff5500, #ff0055);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 5px 20px rgba(255, 85, 0, 0.4);
    animation: hot-pulse 2s infinite;
}

@keyframes hot-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 85, 0, 0.4);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(255, 85, 0, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 85, 0, 0);
    }
}

.hot-heading {
    font-size: 2rem;
    font-weight: 900;
    color: white;
    margin: 0;
}

/* MARQUEE CONTAINER */
.hot-marquee-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}

.hot-track {
    display: flex;
    width: max-content;
    gap: var(--hot-gap);
    /* Animation duration will be set in PHP based on count */
    animation: hot-scroll 40s linear infinite;
    padding-left: var(--hot-gap);
    /* Offset for loop smoothness */
}

/* Pause on Hover */
.hot-track:hover {
    animation-play-state: paused;
}

@keyframes hot-scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(calc(-50% - (var(--hot-gap) / 2)));
    }
}

/* CARD ITEM */
.hot-card {
    position: relative;
    width: var(--hot-card-width);
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.hot-card:hover {
    transform: translateY(-10px) scale(1.05);
    z-index: 10;
}

/* Rank Number */
.hot-rank {
    position: absolute;
    top: -40px;
    right: -20px;
    font-size: 110px;
    font-weight: 900;
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 2px rgba(255, 255, 255, 0.05);
    font-family: 'Outfit', sans-serif;
    pointer-events: none;
    z-index: 0;
    transition: 0.3s;
}

.hot-card:hover .hot-rank {
    -webkit-text-stroke: 2px rgba(255, 85, 0, 0.3);
    transform: translateX(-10px);
}

/* Top 3 Special Ranks */
.hot-card[data-rank="1"] .hot-rank {
    -webkit-text-stroke: 2px rgba(255, 215, 0, 0.3);
}

.hot-card[data-rank="2"] .hot-rank {
    -webkit-text-stroke: 2px rgba(192, 192, 192, 0.3);
}

.hot-card[data-rank="3"] .hot-rank {
    -webkit-text-stroke: 2px rgba(205, 127, 50, 0.3);
}

/* Poster */
.hot-poster {
    display: block;
    width: 100%;
    aspect-ratio: 2/3;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.hot-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.5s ease;
}

.hot-card:hover .hot-img {
    transform: scale(1.1);
    filter: brightness(0.5);
}

/* Overlay Actions */
.hot-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.3s;
}

.hot-card:hover .hot-overlay {
    opacity: 1;
}

.hot-play-btn {
    width: 50px;
    height: 50px;
    background: white;
    color: var(--hot-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transform: scale(0.5);
    transition: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.hot-card:hover .hot-play-btn {
    transform: scale(1);
}

/* Rating */
.hot-rating {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    color: #ffcc00;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 5;
}

/* Info */
.hot-info {
    margin-top: 15px;
    text-align: center;
    position: relative;
    z-index: 2;
}

.hot-title {
    color: white;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 5px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hot-title a {
    color: white;
    text-decoration: none;
    transition: 0.2s;
}

.hot-title a:hover {
    color: var(--hot-accent);
}

.hot-genre {
    color: #888;
    font-size: 12px;
}

/* === MOBILE OPTIMIZATION === */
@media (max-width: 768px) {
    .legendary-hot-section {
        padding: 20px 0 30px 0;
        margin-bottom: 20px;
    }

    .hot-header {
        padding: 0 20px;
        margin-bottom: 30px;
    }

    .hot-heading {
        font-size: 1.5rem;
    }

    .hot-icon {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }

    .hot-track {
        gap: var(--hot-mobile-gap);
        /* Speed up slightly for mobile feel */
        animation-duration: 30s !important;
        padding-left: var(--hot-mobile-gap);
    }

    .hot-card {
        width: var(--hot-mobile-width);
    }

    .hot-rank {
        font-size: 80px;
        top: -25px;
        right: -10px;
    }

    .hot-title {
        font-size: 14px;
    }

    /* Improve touch targets */
    .hot-play-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
}