/**
 * Homepage specific styles
 * Created: 2025-12-31
 */

/* Statistics bar positioning */
.statistics-pc {
    float: left;
}

.statistics {
    bottom: 0;
}

/* Mobile statistics bar - position below banner, not overlapping */
@media (max-width: 959px) {
    .banner {
        position: relative;
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }
    
    /* Mobile statistics bar should be static, not absolute */
    .statistics.wap-statistics {
        position: relative !important;
        bottom: auto !important;
        margin-top: 0 !important;
    }
}

/* Mobile banner auto-height - override diy.css 19/7 ratio */
@media (max-width: 959px) {
    /* Mobile slideshow uses correct ratio, override diy.css aspect-ratio: 19/7 */
    body.page-index .banner .uk-slideshow-items,
    .banner .uk-slideshow-items {
        aspect-ratio: unset !important;
        height: auto !important;
        min-height: unset !important;
    }
    
    /* Slideshow container also needs reset */
    .banner [uk-slideshow],
    .banner .uk-slideshow {
        height: auto !important;
        min-height: unset !important;
    }

    /* Hide PC images, show mobile images */
    .banner .uk-slideshow-items img.uk-visible\@m {
        display: none !important;
    }
    
    .banner .uk-slideshow-items img.uk-hidden\@m {
        display: block !important;
        width: 100%;
        height: auto !important;
        object-fit: contain;
    }
    
    /* Slideshow li items - all slides need correct styles */
    .banner .uk-slideshow-items > li {
        height: auto !important;
        min-height: unset !important;
    }
    
    /* Non-active slides use absolute positioning to hide */
    .banner .uk-slideshow-items > li:not(.uk-active) {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    /* Active slide uses relative positioning to show */
    .banner .uk-slideshow-items > li.uk-active {
        position: relative !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    /* Mobile statistics bar flush under banner, remove white gap */
    .banner .wap-statistics,
    .statistics.wap-statistics {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    /* Mobile statistics bar content vertical centering */
    .wap-statistics {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .wap-statistics .uk-container {
        display: flex !important;
        align-items: center !important;
        height: 100% !important;
    }
    
    .wap-statistics .marquee-container {
        display: flex !important;
        align-items: center !important;
        height: 100% !important;
    }
    
    .wap-statistics .marquee-content {
        display: inline-flex !important;
        align-items: center !important;
    }
    
    .wap-statistics .uk-flex {
        align-items: center !important;
    }
    
    .wap-statistics .item {
        display: flex !important;
        align-items: center !important;
    }
    
    /* Navigation dots position adjustment */
    .banner .uk-position-bottom-center {
        bottom: 10px !important;
    }
    
    /* idx3 title area display */
    .idx3 .idx-type {
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .idx3 .idx-type.wow {
        animation: none !important;
        visibility: visible !important;
    }

    /* idx3 mobile layout fix - force hide non-active slides */
    .idx3 .slides [uk-slideshow] {
        overflow: hidden !important;
    }
    
    .idx3 .slides .uk-slideshow-items {
        position: relative !important;
        overflow: hidden !important;
        min-height: 500px !important;
        background: #f5f5f5 !important;
    }
    
    /* Force hide all non-active slides with display:none */
    .idx3 .slides .uk-slideshow-items > li:not(.uk-active) {
        display: none !important;
    }
    
    /* Active slide visible */
    .idx3 .slides .uk-slideshow-items > li.uk-active {
        display: block !important;
        position: relative !important;
        pointer-events: auto !important;
        z-index: 2 !important;
        background: #f5f5f5 !important;
    }
    
    .idx3 .slides .uk-grid,
    .idx3 .slides [uk-grid] {
        display: flex !important;
        flex-direction: column !important;
    }
    
    .idx3 .slides .col {
        width: 100% !important;
        position: relative !important;
    }
    
    /* First col (product image + text) at bottom */
    .idx3 .slides [uk-grid] > .col:first-child {
        order: 2 !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Second col (scene image) at top */
    .idx3 .slides [uk-grid] > .col:last-child {
        order: 1 !important;
    }
    
    /* Scene image styles - 95% width near edge */
    .idx3 .slides .col .fitImg {
        max-width: 95% !important;
        margin: 0 auto 1rem !important;
        height: auto !important;
    }
    
    .idx3 .slides .col .fitImg img {
        width: 100% !important;
        height: auto !important;
        border-radius: 15px !important;
    }
    
    /* Product image styles - 95% width same as scene image */
    .idx3 .slides .col .small-pic {
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        margin-top: 1rem !important;
        margin-bottom: 0.5rem !important;
        order: 1 !important;
        max-width: 95% !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    
    .idx3 .slides .col .small-pic img {
        max-width: 100% !important;
        height: auto !important;
        margin: 0 auto !important;
        display: block !important;
    }
    
    /* Text and buttons at bottom */
    .idx3 .slides .col .item-tit {
        order: 2 !important;
        margin-top: 0.5rem !important;
    }
    
    .idx3 .slides .col .item-desc {
        order: 3 !important;
    }
    
    .idx3 .slides .col .idx-btns {
        order: 4 !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
        gap: 10px !important;
        margin-top: 1rem !important;
        margin-bottom: 1rem !important;
        padding-bottom: 1rem !important;
    }
    
    .idx3 .slides .col .idx-btns a {
        font-size: 12px !important;
        padding: 8px 15px !important;
        white-space: normal !important;
        text-align: center !important;
        min-width: 120px !important;
    }
    
    /* Navigation dots position */
    .idx3 .slides .uk-position-bottom-center {
        position: relative !important;
        margin-top: 1rem !important;
    }
    
    /* idx3 navigation buttons - keep inside container */
    .idx3 .slides .uk-slidenav-previous,
    .idx3 .slides .uk-slidenav-next {
        position: absolute !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    
    .idx3 .slides .uk-slidenav-previous {
        left: 5px !important;
        right: auto !important;
    }
    
    .idx3 .slides .uk-slidenav-next {
        right: 5px !important;
        left: auto !important;
    }
    
    /* Ensure slides container clips overflow */
    .idx3 .slides {
        overflow: hidden !important;
    }
}

/* PC statistics bar content vertical centering + space-between */
@media (min-width: 960px) {
    /* Hide mobile images on PC */
    .banner .uk-slideshow-items img.uk-hidden\@m {
        display: none !important;
    }
    
    /* PC statistics bar content vertical centering + space-between */
    .statistics.uk-visible\@m {
        display: flex !important;
        align-items: center !important;
    }
    
    .statistics.uk-visible\@m .uk-container {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        height: 100% !important;
        width: 100% !important;
    }
    
    .statistics.uk-visible\@m .uk-container > div {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    .statistics.uk-visible\@m .-items {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        height: 100% !important;
        width: 100% !important;
    }
    
    .statistics.uk-visible\@m .item {
        display: flex !important;
        align-items: center !important;
    }
}

/* idx5 images - show immediately and disable hover/secondary switching */
.idx5 .fitImg img {
    opacity: 1 !important;
    visibility: visible !important;
    transition: none !important;
}

.idx5 .fitImg img + img {
    display: none !important;
}

/* ==================================================================
   New Home Video Storyblock Layout (Playlist + Player)
   ================================================================== */
/* Common Styles */
.video-playlist-layout {
    display: flex;
    gap: 20px;
    padding: 0 0 20px 0;
}

.playlist-item {
    display: flex;
    /* Vertically center content so it aligns with the card border (no top-heavy layout). */
    align-items: center;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
    border: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.playlist-item:hover {
    background-color: #f9f9fa;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.playlist-item.active {
    background-color: #fff;
    border-color: #3e3ab5;
    box-shadow: 0 0 0 1px #3e3ab5 inset;
}

/* Number Badge */
.item-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #3e3ab5;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    margin-right: 15px;
    flex-shrink: 0;
    margin-top: 0;
    box-shadow: 0 4px 8px rgba(62, 58, 181, 0.3);
}

.playlist-item.active .item-number {
    transform: scale(1.1);
}

/* Thumbnail */
.item-thumb {
    width: 100px;
    height: 75px;
    border-radius: 6px;
    object-fit: cover;
    margin-right: 15px;
    background-color: #eee;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Info */
.item-info {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-weight: 700;
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
    line-height: 1.3;
}

.item-desc {
    font-size: 13px;
    color: #777;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Main Video Player */
.main-player-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
}

.main-player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Desktop Styles */
@media (min-width: 960px) {
    .video-playlist-layout {
        gap: 30px;
    }
    .video-playlist-sidebar {
        width: 40%;
        max-height: 520px;
        overflow-y: auto;
        padding-right: 15px;
    }
    .video-player-main {
        width: 60%;
    }
    
    /* Custom Scrollbar for list */
    .video-playlist-sidebar::-webkit-scrollbar {
        width: 5px;
    }
    .video-playlist-sidebar::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }
    .video-playlist-sidebar::-webkit-scrollbar-thumb {
        background: #d1d1d1;
        border-radius: 3px;
    }
    .video-playlist-sidebar::-webkit-scrollbar-thumb:hover {
        background: #aaa;
    }
}

/* Mobile Styles */
@media (max-width: 959px) {
    .video-playlist-layout {
        flex-direction: column-reverse; /* Video Top, Playlist Bottom as requested in Reference (screenshot seems reversed logic, but common mobile is video top. Reference says 'Left Playlist + Right Player' on Desktop. On mobile: usually Player Top is standard, but if user wants Screenshot which had player top, and then numbered list below, then column-reverse depends on DOM order.
        Current DOM order:
        1. Sidebar (List)
        2. Player
        So column-reverse means Player (2) on Top, List (1) on Bottom. This Matches User Request "Video top, list below" */
    }
    
    .video-player-main {
        width: 100%;
        margin-bottom: 20px;
    }
    
    .video-playlist-sidebar {
        width: 100%;
        max-height: 60vh; /* Allow scrolling on mobile if list is long */
        overflow-y: auto;
    }
    
    .playlist-item {
        padding: 10px;
    }
    
    .item-thumb {
        width: 80px;
        height: 60px;
        margin-right: 10px;
    }
    
    .item-title {
        font-size: 15px;
    }
    
    .item-desc {
        font-size: 12px;
    }
}
