/* ================= 1. BASE & CONTAINER ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
}

.hero-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.bg-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
}

/* ================= 2. MUSIC CONTROLS ================= */
header {
    position: absolute;
    top: 5px;
    left: 20px;
    z-index: 999;
}

.all-controls-wrapper,
.music-controls,
.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.all-controls-wrapper {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.music-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    
    /* ប្រើ max-width និង opacity ឱ្យវារួញ/រីកទន់ល្មម មិនទាក់ */
    max-width: 600px;
    opacity: 1;
    overflow: hidden;
    transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.25s ease;
}

.music-controls.hidden {
    max-width: 0;
    opacity: 0;
    pointer-events: none;
    margin: 0;
    padding: 0;
}

/* Song Title Container & Smooth Scrolling Effect */
.song-title-display {
    color: #28f4c1;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    width: 100px;
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.scroll-text {
    display: inline-block;
    white-space: nowrap;
    will-change: transform;
    animation: marqueeSmooth 10s linear infinite;
}

.song-title-display:hover .scroll-text {
    animation-play-state: paused;
}

@keyframes marqueeSmooth {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* Custom Volume Slider & Container */
.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 75px;
    height: 5px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    outline: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.volume-slider:hover {
    background: rgba(255, 255, 255, 0.4);
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #28f4c1;
    box-shadow: 0 0 10px rgba(40, 244, 193, 0.9);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
    background: #ffffff;
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #28f4c1;
    box-shadow: 0 0 10px rgba(40, 244, 193, 0.9);
    cursor: pointer;
    border: none;
    transition: transform 0.2s ease;
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.3);
    background: #ffffff;
}

/* Buttons */
.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.control-btn i {
    transition: transform 0.3s ease;
}

.control-btn:active i {
    transform: scale(0.85);
}

.control-btn:hover {
    background: #28f4c1;
    color: #000;
    box-shadow: 0 0 10px rgba(40, 244, 193, 0.8);
    transform: scale(1.08);
}

/* ================= 3. LOGIN FORM WRAPPER ================= */
.wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    background: rgba(134, 138, 137, 0.29);
    backdrop-filter: blur(8px);
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(255, 254, 254, 0.3);
    width: 350px;
    transition: border 0.2s ease;
}

.wrapper h1 {
    font-family: 'Cooper Black', serif;
    font-size: 35px;
    color: #fff;
    text-align: center;
    margin-bottom: 10px;
}

.wrapper h1:hover {
    text-shadow: 0 0 26px rgba(40, 244, 193, 0.7);
}

/* Input Group */
.input-box {
    position: relative;
    width: 100%;
    height: 50px;
    border-bottom: 2px solid rgba(254, 254, 254, 0.69);
    margin: 30px 0;
}

.input-box input {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    padding-right: 35px;
}

.input-box label {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    color: #fff;
    pointer-events: none;
    transition: 0.3s ease;
}

.input-box input:focus ~ label,
.input-box input:valid ~ label {
    top: -5px;
    font-size: 12px;
    color: #28f4c1;
}

.input-box i,
.input-box .toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
}

.input-box .toggle-password {
    cursor: pointer;
}

.input-box i:hover,
.input-box .toggle-password:hover {
    color: #28f4c1;
}

/* Links & Error */
.remember-forgot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    font-size: 14px;
    margin-bottom: 15px;
}

.remember-forgot a,
.register-link a {
    text-decoration: none;
}

.remember-forgot a {
    color: #fff;
}

.remember-forgot a:hover {
    text-decoration: underline;
}

.remember-forgot input {
    accent-color: #04f100;
    cursor: pointer;
}

.register-link {
    text-align: center;
    margin-top: 15px;
}

.register-link a {
    color: #28f4c1;
    font-weight: 600;
}

.register-link p {
    color: #fff;
    text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.8);
}

.error-msg {
    color: #ff4757;
    font-size: 13px;
    text-align: center;
    margin-top: 10px;
    display: none;
    font-weight: 500;
}

/* ================= 4. BUTTON & ANIMATIONS ================= */
.btn {
    width: 100%;
    height: 40px;
    margin: 20px auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(76, 82, 80, 0.5);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 20px;
    color: #fff;
    font-family: 'Times New Roman', serif;
    transition: 0.5s ease;
}

.btn:hover {
    animation: colorChange 2s infinite linear;
    transform: translateY(-2px);
}

@keyframes colorChange {
    0%, 100% {
        background: #81c4c48c;
        box-shadow: 0 0 15px rgba(115, 243, 239, 0.628);
    }
    33% {
        background: #c963e59c;
        box-shadow: 0 0 15px rgba(206, 141, 239, 0.451);
    }
    66% {
        background: #81f66c9a;
        box-shadow: 0 0 15px rgba(166, 209, 215, 0.44);
    }
}

@keyframes shake {
    0%, 100% { transform: translate(-50%, -50%); }
    20%, 60% { transform: translate(-54%, -50%); }
    40%, 80% { transform: translate(-46%, -50%); }
} 

.wrapper.shake {
    animation: shake 0.2s ease-in-out;
    border: 1px solid #ff4757;
}

/* ================= 5. FILM COUNTDOWN ================= */
.film-countdown {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(83, 82, 82, 0.52);
    border: 3px solid #000;
    margin: 10px auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(13, 13, 13, 1), inset 0 0 10px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.film-countdown .crosshair-v {
    position: absolute;
    width: 2px;
    height: 100%;
    background: #000;
    z-index: 2;
}

.film-countdown .crosshair-h {
    position: absolute;
    width: 100%;
    height: 2px;
    background: #000;
    z-index: 2;
}

.film-countdown .outer-circle,
.film-countdown .inner-circle {
    position: absolute;
    border-radius: 50%;
    border: 1.5px solid #000;
    z-index: 2;
}

.film-countdown .outer-circle {
    width: 70px;
    height: 70px;
}

.film-countdown .inner-circle {
    width: 56px;
    height: 56px;
}

.film-countdown .sweep-spinner {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(0, 242, 250, 0.85) 0deg, rgba(84, 81, 81, 0.46) 90deg, transparent 90deg);
    z-index: 1;
    animation: filmSweep 1s linear infinite;
}

@keyframes filmSweep {
    to { transform: rotate(360deg); }
}

.film-countdown #countdown {
    position: relative;
    z-index: 3;
    font-size: 36px;
    font-weight: 900;
    mix-blend-mode: difference;
    color: #fff;
}

/* ================= 6. MOBILE RESPONSIVE ================= */
@media (max-width: 768px) {
    header {
        top: max(8px, env(safe-area-inset-top)); /* ကာពារកុំឱ្យបាំងដោយកាមេរ៉ាទូរស័ព្ទ */
        left: 12px;                               /* រុញឱ្យមានគម្លាតពីគែមឆ្វេងបន្តិចល្មមស្អាត */
        transform: none;
        width: auto;
        display: block;
        transform-origin: center;
    }

    .all-controls-wrapper {
        padding: 4px 8px;
        gap: 2px;                                 /* បន្ថយចន្លោះបន្តិចការពារហៀរ */
        max-width: 100%;
        justify-content: flex-start;
        
    }

    .music-controls {
        gap: 5px;
        max-width: 100%;
        flex-wrap: nowrap;
    }

    .control-btn {
        width: 30px;                              /* បង្រួមប៊ូតុងបន្តិចឱ្យសមរម្យលើទូរស័ព្ទ */
        height: 30px;
        font-size: 11px;
    }

    .song-title-display {
        width: 55px;                              /* កាត់បន្ថយទំហំបន្តិចការពារបុកប៊ូតុងອື່ນ */
        font-size: 9px;
    }

    .volume-container {
        gap: 3px;
    }

    .volume-slider {
        width: 38px;                              /* បង្រួម Volume bar បន្តិចទៀត */
        height: 4px;
    }

    .volume-slider::-webkit-slider-thumb {
        width: 11px;
        height: 11px;
    }

    .wrapper {
        width: 92%;
        max-width: 330px;
        padding: 20px 20px;                       /* កាត់បន្ថយ Padding ក្នុងប្រអប់ Login បន្តិច */
    }

    .wrapper h1 {
        font-size: 32px;                          /* បង្រួមចំណងជើងកុំឱ្យធំពេកលើទូរស័ព្ទ */
    }

    /* រក្សាទំហំ Film Countdown ឱ្យនៅស្មើកុំឱ្យប្រែប្រួលខុសទម្រង់ */
    .film-countdown {
        width: 75px;
        height: 75px;
    }

    .film-countdown .outer-circle {
        width: 65px;
        height: 65px;
    }

    .film-countdown .inner-circle {
        width: 52px;
        height: 52px;
    }

    .film-countdown #countdown {
        font-size: 32px;
    }
}

/*@media (max-width: 768px) {
    .input-box input {
        font-size: 16px !important; 
        transform: scale(0.9);                    /*ែប្រែពី 0.85 មក 0.9 ឱ្យវាមិនសូវតូចពេក និងងាយមើល */
        transform-origin: left;
        width: 110%;                              /* ទូទាត់សមាមាត្រ scale ថ្មី */
    }
/* จัดวาง Header ឱ្យស្ថិតនៅសងខាងឆ្វេង និងស្តាំអេក្រង់ */
.main-header {
    position: absolute;
    top: 10px;
    margin-left: auto;
    right: 20px;
    display: flex;
    justify-content: space-between; /* រុញផ្នែកឆ្វេង និងស្តាំឱ្យទៅគែមសងខាង */
    align-items: center;
    z-index: 999;
}

/* តុបតែងប្រអប់ Capsule សម្រាប់គ្រាប់ពណ៌ខាងស្តាំ */
.theme-switcher-capsule {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.6);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.color-dot:hover {
    transform: scale(1.25);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}

.color-dot.green { background-color: #28f4c1; }
.color-dot.blue { background-color: #00f2fa; }
.color-dot.purple { background-color: #b19cd9; }