/* New Modal Layout - Video Page Style */

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #1a1a1a;
    border-radius: 15px;
    width: 90%;
    max-width: 1400px;
    height: 85vh;
    max-height: 800px;
    padding: 0;
    cursor: auto;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    gap: 0;
    position: relative;
    border: none;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(100px) brightness(0.5);
    opacity: 0.8;
    z-index: 0;
}

.modal-content.no-video {
    background-color: #333333;
}

/* Left Section - Track Info */
.modal-left-section {
    flex: 0 0 650px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 30px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    z-index: 2;
    overflow-y: hidden;
    border-right: none;
}

.modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.modal-header .album-art-wrapper {
    position: relative;
    width: 60%;
    aspect-ratio: 1;
}

.modal-header .album-art-wrapper::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 10px;
    padding: 12px;
    background: linear-gradient(90deg, #00ffff, #ff00ff, #00ffff, #ff00ff);
    background-size: 300% 100%;
    background-position: 0% 0%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: -1;
    animation: gradientMove 3s linear infinite;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 100% 0%;
    }
}

.modal-header img {
    width: 100%;
    height: 100%;
    aspect-ratio: 1;
    border-radius: 10px;
    background-color: rgba(236, 237, 238, .1);
    display: block;
}

.track-info {
    width: 100%;
    margin-top: 40px;
}

.track-info h2 {
    font-size: 24px;
    margin: 0 0 5px 0;
    color: #fff;
}

.track-info p {
    font-size: 16px;
    margin: 5px 0;
    color: #ccc;
}

.track-info .key-bpm-genre {
    display: inline-block;
    margin-top: 10px;
}

.button-container {
    display: flex;
    gap: 10px;
    margin-top: 3px;
}

/* Right Section - Background Video */
.modal-right-section {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
    margin-left: -2px;
}

.modal-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-video.loaded {
    opacity: 1;
}

/* Bottom Section - Difficulties */
.modal-bottom-section {
    position: absolute;
    bottom: 30px;
    right: 30px;
    z-index: 3;
    display: flex;
    justify-content: flex-end;
}

/* Loading Phrase - Left Side */
.modal-loading-phrase {
    position: absolute;
    bottom: 30px;
    left: 680px;
    z-index: 3;
    padding: 15px 25px;
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    text-align: left;
    transition: text-shadow 0.3s ease;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.7);
    max-width: 400px;
}

.modal-difficulties {
    padding: 15px 25px;
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: fit-content;
    gap: 12px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.7);
}

.modal-body {
    margin-top: 3px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-details {
    padding: 15px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.1);
    color: rgb(255, 255, 255);
}

.modal-details-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-details p {
    margin: 5px 0;
    font-size: 14px;
}

.modal-details strong {
    color: #fff;
}

/* Close Button */
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 40px;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    padding: 5px 10px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    pointer-events: auto;
    touch-action: manipulation;
}

.modal-close:hover,
.modal-close:active {
    background: rgba(0, 0, 0, 0.9);
}

/* Loading Phrase - Left side of video area */
.modal-loading-phrase {
    position: absolute;
    bottom: 30px;
    left: 680px;
    z-index: 3;
    padding: 15px 25px;
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    text-align: left;
    transition: text-shadow 0.3s ease;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.7);
    max-width: 400px;
}

.modal-loading-phrase.glow {
    text-shadow: 0 0 10px #ffffff, 0 0 20px #ffffff, 0 0 30px #ffffff;
}

.rank-reward-text {
    display: inline-block;
    margin-top: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffffff;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .modal-content {
        width: 95%;
        height: 90vh;
        flex-direction: column;
    }

    .modal-left-section {
        flex: 0 0 auto;
        max-height: 50%;
        padding: 20px;
    }

    .modal-right-section {
        flex: 1;
        min-height: 300px;
    }

    .modal-bottom-section {
        right: 20px;
        bottom: 20px;
    }

    .modal-difficulties {
        gap: 10px;
        padding: 12px 15px;
    }

    .modal-header img {
        max-width: 200px;
        margin: 0 auto;
    }

    .modal-loading-phrase {
        left: 20px;
        bottom: 80px;
        max-width: 300px;
        font-size: 13px;
        padding: 12px 20px;
    }
}

@media (max-width: 768px) {
    .modal-content {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        max-height: none;
        flex-direction: column;
        top: 0;
        left: 0;
        transform: none;
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Video as full background on mobile */
    .modal-right-section {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1;
    }

    .modal-video {
        width: 100%;
        height: 100%;
        object-fit: cover;
        cursor: pointer;
        transition: transform 0.3s ease;
    }

    /* Allow video zoom on mobile */
    .modal-video.zoomed {
        transform: scale(1.5);
        cursor: zoom-out;
    }

    /* Full-screen blur overlay */
    .modal-content::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 2;
        pointer-events: none;
    }
    
    /* Ensure close button is above blur overlay */
    .modal-close {
        z-index: 1001 !important;
    }

    /* Left section overlays the blur */
    .modal-left-section {
        position: relative;
        z-index: 3;
        padding: 40px 15px;
        padding-bottom: 200px;
        gap: 5px;
        background: transparent;
        backdrop-filter: none;
        flex: 0 0 auto;
        max-height: none;
        min-height: 100vh;
        border-right: none;
    }

    .modal-header .album-art-wrapper {
        width: 80%;
    }

    .modal-header img {
        max-width: none;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .modal-loading-phrase {
        position: absolute;
        left: 15px;
        bottom: -30px;
        margin-top: 80px;
        max-width: 250px;
        font-size: 12px;
        padding: 10px 15px;
        z-index: 4;
    }

    .track-info h2 {
        font-size: 20px;
    }

    .track-info p {
        font-size: 14px;
    }

    .modal-close {
        top: 10px;
        right: 10px;
        font-size: 30px;
        width: 40px;
        height: 40px;
        z-index: 1000;
        pointer-events: auto;
        touch-action: manipulation;
        background: rgba(0, 0, 0, 0.8);
        display: none;
    }

    .modal-bottom-section {
        position: absolute;
        bottom: -25px;
        right: 15px;
        margin-top: 80px;
        z-index: 4;
    }

    .modal-difficulties {
        gap: 8px;
        padding: 10px 12px;
        min-height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .difficulty {
        margin-right: 0;
    }
}
