/* --- LYNK LEE MUSIC BOX V8.1 (BẢN FULL GIỮ NGUYÊN CSS GỐC) --- */

/* Font được load qua functions.php để tránh block rendering */

.lynk-wrapper-v7 {
    max-width: 1100px;
    margin: 80px auto 20px !important;
    /* Cân đối margin-top */
    padding-top: 0;
    /* Bỏ padding-top */
    font-family: 'Quicksand', sans-serif;
    /* Đổi font chung cho đồng bộ Fashion */
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* Đảm bảo hiển thị trên mọi màn hình */
#lynk-music-section,
.lynk-wrapper-v7 {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* --- PHẦN THÊM VÀO: ĐIỀU HƯỚNG PORTAL (GIỐNG FASHION) --- */
.f-portal-nav {
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    margin-top: 0;
    margin-bottom: 20px;
    /* Khoảng cách cân đối với khung nhạc */
    position: relative;
    z-index: 100;
}

.f-portal-link {
    text-decoration: none !important;
    color: rgba(0, 255, 180, 0.4);
    font-size: 11px;
    letter-spacing: 4px;
    font-weight: 700;
    transition: 0.4s;
    position: relative;
}

.f-portal-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -3px;
    left: 0;
    background: #00ffb4;
    transition: 0.4s;
}

.f-portal-link:hover {
    color: #00ffb4 !important;
    text-shadow: 0 0 10px #00ffb4;
}

.f-portal-link:hover::after {
    width: 100%;
}

/* --- DƯỚI ĐÂY LÀ CSS GỐC CỦA BẠN (GIỮ NGUYÊN 100%) --- */
.lynk-header-gap {
    height: 0px;
}

.lynk-layout-grid {
    display: flex;
    gap: 30px;
    height: 570px;
    align-items: stretch;
}

.lynk-main-card {
    flex: 0 0 40%;
    background-color: rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 15px;
    overflow: hidden;
    transform: translateX(-100%);
    opacity: 0;
}

/* Animation trượt từ trái vào khi vào trang #music */
.lynk-main-card.m-animate-in {
    animation: slideInFromLeft 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes slideInFromLeft {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }

    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.lynk-scroll-v7 {
    height: 100%;
    overflow-y: auto;
    padding-right: 5px;
}

.song-item-v7 {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    margin-bottom: 8px;
    border-radius: 14px;
    background-color: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.25s ease;
    min-height: 75px;
    position: relative;
}

.song-item-v7.active {
    background-color: rgba(0, 242, 173, 0.15) !important;
    border-left: 4px solid #00F2AD;
}

.song-body-v7 {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

/* Ẩn các phần tử mobile trên desktop */
.song-thumbnail-mobile,
.song-lyric-btn-mobile,
.mobile-lyric-panel {
    display: none !important;
}

.song-index-v7 {
    width: 30px;
    font-size: 13px;
    color: #00F2AD;
    font-weight: 700;
    opacity: 0.6;
}

.song-name-v7 {
    color: #F7E7CE;
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
}

.song-singer-v7 {
    color: #00F2AD;
    font-size: 0.8rem;
    opacity: 0.7;
    margin: 0;
}

.lynk-visualizer-mini {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 18px;
    position: absolute;
    right: 20px;
    display: none;
}

.song-item-v7.active .lynk-visualizer-mini {
    display: flex;
}

.lynk-visualizer-mini span {
    width: 3px;
    background-color: #00F2AD;
    border-radius: 3px;
    animation: musicWave 0.6s infinite alternate;
}

.lynk-visualizer-mini span:nth-child(2) {
    animation-delay: 0.2s;
}

.lynk-visualizer-mini span:nth-child(3) {
    animation-delay: 0.4s;
}

.lynk-visualizer-mini span:nth-child(4) {
    animation-delay: 0.1s;
}

@keyframes musicWave {
    0% {
        height: 4px;
    }

    100% {
        height: 18px;
    }
}

.lynk-side-card {
    flex: 1;
    background-color: rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    transform: translateX(100%);
    opacity: 0;
}

/* Animation trượt từ phải vào khi vào trang #music */
.lynk-side-card.m-animate-in {
    animation: slideInFromRight 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes slideInFromRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }

    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.lynk-slider-v7 {
    display: flex;
    width: 200%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.lynk-slider-v7.is-active {
    transform: translateX(-50%);
}

.lynk-page-v7 {
    width: 50%;
    height: 100%;
    padding: 35px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-height: 0;
}

.focus-thumb-v7 {
    width: 100% !important;
    flex-grow: 1;
    max-height: 350px;
    overflow: hidden !important;
    border-radius: 20px !important;
    margin-bottom: 20px !important;
    background-color: transparent !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

#main-thumb-display {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.focus-tag-v7 {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.1);
    color: #eee;
    font-size: 10px;
    font-weight: 900;
    padding: 4px 12px;
    border-radius: 50px;
    margin-bottom: 10px;
}

.focus-tag-v7.active-tag {
    background-color: #F7E7CE !important;
    color: #000 !important;
}

#focus-title {
    color: #F7E7CE;
    font-size: 1.6rem !important;
    font-weight: 800;
    margin: 5px 0;
}

#focus-artist {
    color: #00F2AD;
    font-size: 0.95rem !important;
    opacity: 0.8;
}

.lyric-toggle-btn {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    background-color: rgba(0, 242, 173, 0.1) !important;
    border: 1px solid rgba(0, 242, 173, 0.2) !important;
    color: #00F2AD !important;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    margin-top: 15px;
}

.body-lyrics-v7 {
    flex: 1;
    overflow-y: auto;
    text-align: center;
    font-size: 1.2rem;
    line-height: 0.8;
    color: #F7E7CE;
    padding: 20px 0;
    white-space: pre-line;
    min-height: 0;
    /* CRITICAL: Cho phép flex child scroll */
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling trên iOS/macOS */
}

.minimal-back-btn {
    background-color: transparent !important;
    border: none !important;
    color: #00F2AD !important;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
}

/* Tablet */
@media (max-width: 1024px) {
    .lynk-wrapper-v7 {
        margin: 60px auto 20px;
        padding: 0 20px;
        max-width: 100%;
    }

    .lynk-layout-grid {
        flex-direction: column;
        height: auto;
        gap: 20px;
        min-height: auto;
    }

    .lynk-main-card {
        width: 100%;
        height: auto;
        min-height: 400px;
        max-height: 60vh;
        flex: none;
    }

    .lynk-scroll-v7 {
        max-height: 60vh;
        overflow-y: auto;
    }

    .lynk-side-card {
        width: 100%;
        height: auto;
        min-height: 500px;
        max-height: 70vh;
        flex: none;
    }

    .lynk-page-v7 {
        padding: 25px 20px;
        max-height: 70vh;
        overflow-y: auto;
    }

    .f-portal-nav {
        margin-bottom: 20px;
        padding: 0 5px;
    }

    .f-portal-link {
        font-size: 10px;
        letter-spacing: 3px;
    }
}

/* Mobile - VERTICAL SLIDER LAYOUT */
@media (max-width: 768px), (max-width: 1024px) and (orientation: portrait) {

    /* Section container - VERTICAL SLIDER */
    #music {
        position: relative !important;
        transform: translateY(0) !important;
        -webkit-transform: translateY(0) !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        left: 0 !important;
        right: auto !important;
    }

    /* Force tất cả containers trong #music */
    #music .elementor-element,
    #music .elementor-shortcode,
    #music .e-con,
    #music .e-container,
    #music [class*="elementor"] {
        max-width: 100% !important;
        width: 100% !important;
        position: relative !important;
        left: 0 !important;
        transform: none !important;
        -webkit-transform: none !important;
    }

    /* Wrapper - VERTICAL LAYOUT */
    #music #lynk-music-section,
    #music .lynk-wrapper-v7 {
        margin: 0 auto !important;
        padding: 60px 15px 20px 15px !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        position: relative !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Reset box-sizing */
    #music * {
        box-sizing: border-box;
    }

    /* Layout Grid - VERTICAL STACK */
    .lynk-layout-grid {
        gap: 15px !important;
        height: auto !important;
        min-height: auto !important;
        flex-direction: column !important;
        width: 100% !important;
        flex: 1 !important;
        overflow-y: auto !important;
        align-items: center !important;
    }

    .lynk-main-card {
        height: 70vh !important;
        min-height: 70vh !important;
        max-height: 70vh !important;
        padding: 12px !important;
        border-radius: 20px !important;
        flex: 0 0 auto !important;
        width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        align-self: center !important;
        box-sizing: border-box !important;
        transform: none !important;
        opacity: 1 !important;
        margin-top: 30px !important;
        margin-bottom: 0 !important;
    }

    .lynk-scroll-v7 {
        height: 100% !important;
        max-height: 100% !important;
        overflow-y: auto !important;
        width: 100% !important;
        scrollbar-width: none !important;
        /* Firefox */
        -ms-overflow-style: none !important;
        /* IE/Edge */
    }

    .lynk-scroll-v7::-webkit-scrollbar {
        display: none !important;
        /* Chrome/Safari */
    }

    .lynk-side-card {
        height: auto !important;
        min-height: 300px !important;
        max-height: 50vh !important;
        flex: 0 0 auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .lynk-page-v7 {
        padding: 20px 15px !important;
        max-height: 50vh !important;
        overflow-y: auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .focus-thumb-v7 {
        max-height: 180px;
        margin-bottom: 15px;
    }

    #focus-title {
        font-size: 1.2rem !important;
    }

    #focus-artist {
        font-size: 0.85rem !important;
    }

    .song-item-v7 {
        padding: 10px 15px;
        min-height: 65px;
        align-items: center !important;
    }

    .song-name-v7 {
        font-size: 0.85rem;
    }

    .song-singer-v7 {
        font-size: 0.75rem;
    }

    .f-portal-nav {
        margin-bottom: 15px;
        margin-top: 0 !important;
        flex-wrap: wrap;
        gap: 10px;
        padding: 0 10px;
    }

    .f-portal-link {
        font-size: 9px;
        letter-spacing: 2px;
    }

    .body-lyrics-v7 {
        font-size: 0.95rem;
        padding: 15px 0;
        max-height: 35vh;
        overflow-y: auto;
        scrollbar-width: none !important;
        /* Firefox */
        -ms-overflow-style: none !important;
        /* IE/Edge */
    }

    .body-lyrics-v7::-webkit-scrollbar {
        display: none !important;
        /* Chrome/Safari */
    }

    /* Ẩn navigation trên mobile */
    #music .f-portal-nav,
    #music .lynk-wrapper-v7 .f-portal-nav,
    .lynk-wrapper-v7 .f-portal-nav {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Style thumbnail trong song-item */
    .song-thumbnail-mobile {
        width: 45px;
        min-width: 45px;
        height: 45px;
        border-radius: 8px;
        overflow: hidden;
        margin: 0 10px;
        flex-shrink: 0;
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.2);
        align-self: center;
    }

    .song-thumbnail-mobile img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .song-thumbnail-placeholder {
        width: 100%;
        height: 100%;
        background: rgba(0, 242, 173, 0.1);
        border: 1px solid rgba(0, 242, 173, 0.2);
    }

    /* Style nút Lyric */
    .song-lyric-btn-mobile {
        background: rgba(0, 242, 173, 0.15);
        border: 1px solid rgba(0, 242, 173, 0.3);
        color: #00F2AD;
        padding: 6px 12px;
        border-radius: 6px;
        font-family: 'Quicksand', sans-serif;
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 1px;
        cursor: pointer;
        margin-left: auto;
        transition: all 0.3s ease;
        flex-shrink: 0;
        display: block !important;
    }

    .song-lyric-btn-mobile:hover {
        background: rgba(0, 242, 173, 0.25);
        border-color: rgba(0, 242, 173, 0.5);
        transform: scale(1.05);
    }

    .song-lyric-btn-mobile:active {
        transform: scale(0.95);
    }

    /* Sửa layout song-item cho mobile */
    .song-item-v7 {
        display: flex !important;
        align-items: center !important;
        gap: 0 !important;
    }

    /* Ẩn visualizer mini trên mobile */
    .lynk-visualizer-mini {
        display: none !important;
    }

    /* Đảm bảo wrapper có position relative để lyric panel absolute hoạt động */
    .lynk-main-card {
        position: relative !important;
        overflow: hidden !important;
    }

    /* Mobile Lyric Panel - Trượt vào vị trí khung danh sách phát */
    .mobile-lyric-panel {
        position: absolute;
        top: 0;
        left: 100%;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.85) !important;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 20px;
        z-index: 100;
        transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        display: none !important;
        flex-direction: column;
        box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-lyric-panel.show {
        left: 0;
        display: flex !important;
    }

    .mobile-lyric-header {
        padding: 15px 15px;
        border-bottom: 1px solid rgba(0, 242, 173, 0.2);
        flex-shrink: 0;
    }

    .mobile-lyric-back-btn {
        background: transparent;
        border: 1px solid rgba(0, 242, 173, 0.3);
        color: #00F2AD;
        padding: 10px 20px;
        border-radius: 8px;
        font-family: 'Quicksand', sans-serif;
        font-size: 14px;
        font-weight: 600;
        letter-spacing: 1px;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .mobile-lyric-back-btn:hover {
        background: rgba(0, 242, 173, 0.1);
        border-color: rgba(0, 242, 173, 0.5);
    }

    .mobile-lyric-content {
        flex: 1;
        padding: 20px 15px;
        overflow-y: auto;
        font-family: 'Quicksand', sans-serif;
        font-size: 14px;
        line-height: 1.8;
        color: #F7E7CE;
        white-space: pre-line;
        min-height: 0;
        scrollbar-width: none !important;
        /* Firefox */
        -ms-overflow-style: none !important;
        /* IE/Edge */
    }

    .mobile-lyric-content::-webkit-scrollbar {
        display: none !important;
        /* Chrome/Safari */
    }

    /* Ẩn side-card trên mobile */
    .lynk-side-card {
        display: none !important;
    }
}

/* Small Mobile - VERTICAL SLIDER */
@media (max-width: 480px) {
    #music {
        height: 100vh !important;
    }

    #music #lynk-music-section,
    #music .lynk-wrapper-v7 {
        padding: 50px 10px 15px 10px !important;
    }

    .lynk-layout-grid {
        gap: 12px !important;
        max-height: calc(100vh - 100px) !important;
    }

    .lynk-main-card {
        height: 70vh !important;
        min-height: 70vh !important;
        max-height: 70vh !important;
        padding: 10px !important;
        border-radius: 16px !important;
        margin-top: 30px !important;
        margin-bottom: 0 !important;
    }

    .lynk-scroll-v7 {
        height: 100% !important;
        max-height: 100% !important;
        scrollbar-width: none !important;
        /* Firefox */
        -ms-overflow-style: none !important;
        /* IE/Edge */
    }

    .lynk-scroll-v7::-webkit-scrollbar {
        display: none !important;
        /* Chrome/Safari */
    }

    .song-item-v7 {
        align-items: center !important;
    }

    .song-thumbnail-mobile {
        height: 45px;
        align-self: center;
    }

    .mobile-lyric-panel {
        height: 100%;
        min-height: 100%;
        max-height: 100%;
    }

    .lynk-main-card {
        position: relative !important;
    }

    .lynk-side-card {
        min-height: 280px !important;
        max-height: 45vh !important;
    }

    .lynk-page-v7 {
        padding: 15px 12px !important;
        max-height: 45vh !important;
    }

    .focus-thumb-v7 {
        max-height: 150px;
        margin-bottom: 12px;
    }

    #focus-title {
        font-size: 1rem !important;
    }

    #focus-artist {
        font-size: 0.75rem !important;
    }

    .song-item-v7 {
        padding: 8px 12px;
        min-height: 60px;
        margin-bottom: 6px;
        align-items: center !important;
    }

    .song-name-v7 {
        font-size: 0.8rem;
    }

    .song-singer-v7 {
        font-size: 0.7rem;
    }

    .song-index-v7 {
        width: 25px;
        font-size: 12px;
    }

    .f-portal-nav {
        margin-bottom: 12px;
        padding: 0 5px;
    }

    .f-portal-link {
        font-size: 8px;
        letter-spacing: 1.5px;
    }

    .body-lyrics-v7 {
        font-size: 0.85rem;
        line-height: 1.5;
        padding: 12px 0;
        max-height: 30vh;
        overflow-y: auto;
        scrollbar-width: none !important;
        /* Firefox */
        -ms-overflow-style: none !important;
        /* IE/Edge */
    }

    .body-lyrics-v7::-webkit-scrollbar {
        display: none !important;
        /* Chrome/Safari */
    }

    .lyric-toggle-btn {
        padding: 10px;
        font-size: 8px;
    }
}