/* --- 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 */

/*
 * Khoảng dưới [lynk_navbar] fixed: .lynk-navbar-wrap + .lynk-navbar-shell + brand ~1.5rem
 * cao hơn --lynk-content-below-header thuần — dùng max(biến + đệm, safe-area + tối thiểu px/rem).
 */
#lynk-music-section.lynk-music-page {
    padding-top: max(
        calc(2.3rem + env(safe-area-inset-top, 0px)),
        calc(var(--lynk-content-below-header) - 4.5rem)
    );
}

.lynk-wrapper-v7 {
    max-width: 1100px;
    margin: 0 auto 20px !important;
    font-family: var(--lynk-font-body);
    /* Đổ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: var(--lynk-neon-alt);
    transition: 0.4s;
}

.f-portal-link:hover {
    color: var(--lynk-neon-alt) !important;
    text-shadow: 0 0 10px var(--lynk-neon-alt);
}

.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;
}

/* Gradient / font tiêu đề: lynk-video-anlie.css (.lynk-hero-section, .lynk-hero-title, .lynk-hero-sub) */
.lynk-music-page-heading {
    text-align: center;
    max-width: 760px;
    margin: 0 auto 26px;
}

.lynk-music-page-player-wrap {
    display: flex;
    justify-content: center;
    margin: 0 auto 30px;
}

#lynk-music-section .lynk-music-page-player-wrap .lynk-player-wrapper {
    width: 100%;
    max-width: 950px;
    margin: 0 auto;
}

.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 nhạc */
.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(var(--lynk-neon-rgb), 0.15) !important;
    border-left: 4px solid var(--lynk-neon);
}

.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: var(--lynk-neon);
    font-weight: 700;
    opacity: 0.6;
}

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

.song-singer-v7 {
    color: var(--lynk-neon);
    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: var(--lynk-neon);
    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 nhạc */
.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: var(--lynk-neon);
    font-size: 0.95rem !important;
    opacity: 0.8;
}

.lyric-toggle-btn {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    background-color: rgba(var(--lynk-neon-rgb), 0.1) !important;
    border: 1px solid rgba(var(--lynk-neon-rgb), 0.2) !important;
    color: var(--lynk-neon) !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: var(--lynk-neon) !important;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
}

/* Tablet — padding-top do #lynk-music-section.lynk-music-page (toàn breakpoint) */
@media (max-width: 1024px) {
    .lynk-wrapper-v7 {
        margin: 0 auto 20px;
        padding-left: 20px;
        padding-right: 20px;
        padding-bottom: 0;
        max-width: 100%;
    }

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

    .lynk-music-page-heading {
        margin-bottom: 22px;
    }

    .lynk-music-page-player-wrap {
        margin-bottom: 24px;
    }

    .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) {

    /* Gốc shortcode nhạc (.lynk-music-page trên #lynk-music-section) — thay cho id #music thời slider ngang */
    .lynk-music-page {
        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;
        z-index: 0 !important;
        isolation: isolate;
    }

    /* Cha Elementor bọc shortcode (không còn wrapper #music) */
    .elementor-widget-shortcode:has(.lynk-music-page),
    .elementor-element:has(.lynk-music-page),
    .e-con:has(.lynk-music-page),
    .e-container:has(.lynk-music-page) {
        max-width: 100% !important;
        width: 100% !important;
        position: relative !important;
        left: 0 !important;
        transform: none !important;
        -webkit-transform: none !important;
    }

    /* Wrapper - VERTICAL LAYOUT */
    .lynk-music-page.lynk-wrapper-v7,
    #lynk-music-section.lynk-music-page {
        margin: 0 auto !important;
        padding-top: max(calc(2.3rem + env(safe-area-inset-top, 0px)), calc(var(--lynk-content-below-header) - 4.5rem)) !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
        padding-bottom: 20px !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;
    }

    .lynk-music-page *,
    .lynk-music-page *::before,
    .lynk-music-page *::after {
        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-music-page-heading {
        margin: 0 auto 16px !important;
        padding: 0 8px !important;
    }

    .lynk-music-page-title {
        font-size: clamp(1.5rem, 7vw, 2.1rem) !important;
        margin-bottom: 8px !important;
    }

    .lynk-music-page-subtitle {
        font-size: 0.92rem !important;
    }

    .lynk-music-page-player-wrap {
        margin-bottom: 18px !important;
        width: 100% !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 */
    .lynk-music-page .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(var(--lynk-neon-rgb), 0.1);
        border: 1px solid rgba(var(--lynk-neon-rgb), 0.2);
    }

    /* Style nút Lyric */
    .song-lyric-btn-mobile {
        background: rgba(var(--lynk-neon-rgb), 0.15);
        border: 1px solid rgba(var(--lynk-neon-rgb), 0.3);
        color: var(--lynk-neon);
        padding: 6px 12px;
        border-radius: 6px;
        font-family: var(--lynk-font-body);
        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(var(--lynk-neon-rgb), 0.25);
        border-color: rgba(var(--lynk-neon-rgb), 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(var(--lynk-neon-rgb), 0.2);
        flex-shrink: 0;
    }

    .mobile-lyric-back-btn {
        background: transparent;
        border: 1px solid rgba(var(--lynk-neon-rgb), 0.3);
        color: var(--lynk-neon);
        padding: 10px 20px;
        border-radius: 8px;
        font-family: var(--lynk-font-body);
        font-size: 14px;
        font-weight: 600;
        letter-spacing: 1px;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .mobile-lyric-back-btn:hover {
        background: rgba(var(--lynk-neon-rgb), 0.1);
        border-color: rgba(var(--lynk-neon-rgb), 0.5);
    }

    .mobile-lyric-content {
        flex: 1;
        padding: 20px 15px;
        overflow-y: auto;
        font-family: var(--lynk-font-body);
        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) {
    .lynk-music-page {
        height: 100vh !important;
    }

    .lynk-music-page.lynk-wrapper-v7,
    #lynk-music-section.lynk-music-page {
        padding-top: max(calc(2.3rem + env(safe-area-inset-top, 0px)), calc(var(--lynk-content-below-header) - 4.5rem)) !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        padding-bottom: 15px !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;
    }
}
/* Hero title cho trang nhạc: giống palette bạn yêu cầu */
.lynk-music-page-title.lynk-hero-title {
    background: linear-gradient(to bottom, #f7e7ce 0%, rgba(247, 231, 206, 0.62) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.lynk-music-page-title.lynk-hero-title span {
    background: linear-gradient(90deg, var(--lynk-neon) 0%, #b7ffe9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Trang nhạc (.lynk-music-page): navbar cố định phải trên .lynk-main-ui (z-index 9999), giữ backdrop rõ */
@media (max-width: 768px), (max-width: 1024px) and (orientation: portrait) {
    body:has(.lynk-music-page) .lynk-navbar-wrap {
        z-index: 10050;
        isolation: isolate;
    }

    body:has(.lynk-music-page) .lynk-navbar-shell {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
}
