/* ==========================================================================
   StreamFliz Ultra-Fast Details Page Stylesheet (details.min.css)
   High Security, Zero Cumulative Layout Shift (CLS), Pure CSS Performance
   ========================================================================== */

:root {
    --primary: #e90000;
    --primary-hover: #ff1a1a;
    --bg-dark: #000000;
}

body {
    background-color: #000000 !important;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

#wrapper {
    background: transparent !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
}

#sidebar_menu {
    z-index: 10001 !important;
}

#sidebar_menu_bg {
    z-index: 10000 !important;
}

#search-suggest {
    z-index: 2000 !important;
}

#notif_menu {
    z-index: 2000 !important;
}

/* 1. Details Page Skeleton Shimmer Placeholders (Zero CLS Frame 1) */
.detail-skeleton {
    position: relative;
    overflow: hidden;
    background: #111116;
}

.detail-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.06) 50%, transparent 100%);
    animation: detailShimmer 1.6s infinite;
}

@keyframes detailShimmer {
    100% {
        transform: translateX(100%);
    }
}

.detail-skeleton-box {
    border-radius: 14px;
    background: #13131a;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-skeleton-poster {
    width: 100%;
    aspect-ratio: 2/3;
    border-radius: 16px;
    background: #14141c;
}

.detail-skeleton-line {
    height: 14px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
}

.detail-skeleton-btn {
    height: 44px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.08);
}

/* 2. Custom Modern Detail Scoped Styling */
.genre-tag {
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.genre-tag:hover {
    background-color: #e90000 !important;
    color: #ffffff !important;
    border-color: #e90000 !important;
    transform: translateY(-1.5px);
    box-shadow: 0 4px 15px rgba(233, 0, 0, 0.35);
}

.detail-tab-btn.is-active {
    border-bottom-color: #e90000 !important;
    color: #ffffff !important;
}

.season-card:hover {
    border-color: #e90000 !important;
    box-shadow: 0 0 25px rgba(233, 0, 0, 0.3) !important;
}

/* 3. Sleek Modern Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #000000;
}

::-webkit-scrollbar-thumb {
    background: #27272a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #e90000;
}

/* 4. Modal Fix: Ensure modals are completely hidden unless explicitly opened */
.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 99999 !important;
    display: none !important;
    width: 100vw !important;
    height: 100vh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    outline: 0;
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

.modal.show,
.modal.in,
.modal.is-open {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.modal-dialog {
    position: relative !important;
    width: 92% !important;
    max-width: 750px !important;
    margin: auto !important;
    pointer-events: auto !important;
}

.modal-backdrop {
    display: none !important;
}

#wl-dropdown-menu.show {
    display: block !important;
}

.tab-content-panel {
    display: none;
}

.tab-content-panel.block, 
.tab-content-panel.active {
    display: block !important;
}

/* 5. External Database Links (TMDB / AniList / MyAnimeList) */
.external-db-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    text-decoration: none !important;
    font-size: 12px;
    font-weight: 600;
    color: #a1a1aa;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.external-db-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #ffffff !important;
    transform: translateX(3px);
}

/* 6. Glowing Play Hover Overlay for Recommended Anime Cards */
.card-play-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(235, 13, 13, 0.18) 0%, rgba(10, 10, 16, 0.65) 100%);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6;
    pointer-events: none;
}

.group:hover .card-play-overlay,
.flw-item:hover .card-play-overlay {
    opacity: 1;
}

.card-play-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff1e1e 0%, #b80505 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    padding-left: 2px;
    box-shadow: 0 8px 24px rgba(235, 13, 13, 0.65), 0 0 20px rgba(255, 59, 48, 0.4);
    transform: scale(0.7) translateY(4px);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.group:hover .card-play-circle,
.flw-item:hover .card-play-circle {
    transform: scale(1) translateY(0);
}

/* Recommendations Home-Style Film Cards & Meta Lines */
#tab-recommendations .film_list-wrap {
    margin: -0.5rem;
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
}

#tab-recommendations .flw-item {
    width: calc(20% - 1rem);
    margin: 0.5rem;
    position: relative;
    margin-bottom: 22px;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (max-width: 1200px) {
    #tab-recommendations .flw-item {
        width: calc(25% - 1rem);
    }
}
@media (max-width: 768px) {
    #tab-recommendations .flw-item {
        width: calc(33.333% - 1rem);
    }
}
@media (max-width: 576px) {
    #tab-recommendations .flw-item {
        width: calc(50% - 0.75rem);
        margin: 0.375rem;
    }
}

#tab-recommendations .film-poster {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #14141c;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#tab-recommendations .flw-item:hover .film-poster {
    transform: translateY(-4px) !important;
    border-color: rgba(235, 13, 13, 0.5) !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.7), 0 0 16px rgba(235, 13, 13, 0.3) !important;
}

#tab-recommendations .film-poster-img {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}

#tab-recommendations .flw-item:hover .film-poster-img {
    transform: scale(1.07) !important;
}

#tab-recommendations .latest-meta-line {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 11px;
}

#tab-recommendations .latest-format-badge {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    padding: 1px 6px;
    font-weight: 700;
    color: #e4e4e7;
    letter-spacing: 0.2px;
}

#tab-recommendations .latest-dot {
    color: rgba(255, 255, 255, 0.25);
    font-size: 9px;
}

#tab-recommendations .latest-duration-text {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
}

#tab-recommendations .film-name {
    font-size: 13.5px !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    margin: 0 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 36px;
}

#tab-recommendations .film-name a {
    color: #e4e4e7 !important;
    text-decoration: none !important;
    transition: color 0.2s ease;
}

#tab-recommendations .flw-item:hover .film-name a {
    color: #ff3b30 !important;
}

/* ==========================================================================
   Telegram Community Modal Popup System
   ========================================================================== */
.tg-modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease;
    box-sizing: border-box !important;
    padding: 16px !important;
}

.tg-modal-overlay.show {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.tg-modal-backdrop {
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.78) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    z-index: 1 !important;
    cursor: pointer;
}

.tg-modal-dialog {
    position: relative !important;
    z-index: 10 !important;
    width: 100% !important;
    max-width: 380px !important;
    background: #0d1319 !important;
    background: linear-gradient(180deg, #131b24 0%, #0a0f14 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 20px !important;
    padding: 24px !important;
    box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.85), 0 0 35px rgba(14, 165, 233, 0.18) !important;
    transform: scale(0.92) translateY(12px);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease;
    box-sizing: border-box !important;
    color: #ffffff !important;
    text-align: left;
    margin: auto !important;
}

.tg-modal-overlay.show .tg-modal-dialog {
    transform: scale(1) translateY(0) !important;
}

.tg-modal-close-btn {
    position: absolute !important;
    right: 14px !important;
    top: 14px !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.6) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    padding: 0 !important;
    transition: all 0.2s ease !important;
    outline: none !important;
    z-index: 2 !important;
}

.tg-modal-close-btn:hover,
.tg-modal-close-btn:focus {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    transform: rotate(90deg);
}

.tg-modal-icon {
    width: 56px !important;
    height: 56px !important;
    border-radius: 16px !important;
    background: rgba(14, 165, 233, 0.15) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    color: #38bdf8 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 28px !important;
    margin-bottom: 14px !important;
}

.tg-modal-title {
    font-size: 19px !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    color: #ffffff !important;
    margin: 0 0 6px 0 !important;
    line-height: 1.3 !important;
}

.tg-modal-desc {
    font-size: 13.5px !important;
    line-height: 1.5 !important;
    color: rgba(255, 255, 255, 0.65) !important;
    margin: 0 0 20px 0 !important;
}

.tg-modal-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
}

.tg-modal-btn-join {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 12px 18px !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%) !important;
    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    border: none !important;
    cursor: pointer !important;
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.35) !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
}

.tg-modal-btn-join:hover {
    background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 10px 24px rgba(14, 165, 233, 0.5) !important;
    transform: translateY(-1px);
    text-decoration: none !important;
}

.tg-modal-btn-later {
    width: 100% !important;
    padding: 11px 18px !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
    outline: none !important;
    text-align: center;
}

.tg-modal-btn-later:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
}

body.tg-modal-open {
    overflow: hidden !important;
}
