@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;700&display=swap');

/* Hiệu ứng "Nảy" cho Visualizer */
@keyframes bounce-bar {
    0%, 100% { transform: scaleY(0.2); }
    50% { transform: scaleY(1); }
}

/* Hiệu ứng chạy chữ (ĐÃ SỬA LẠI HOÀN CHỈNH) */
@keyframes marquee {
    0% { transform: translateX(0%); } /* Bắt đầu từ vị trí 0 */
    /* Chạy hết chiều rộng của span + padding */
    100% { transform: translateX(calc(-100% - 30px)); }
}
/* ---- CODE MỚI: Hiệu ứng tia sáng chạy quanh ---- */
@keyframes rotating-border-glow {
    0%   { border-color: rgba(255, 255, 255, 0.7); box-shadow: 0 0 8px 2px rgba(255, 255, 255, 0.5); }
    25%  { border-color: rgba(100, 100, 255, 0.8); box-shadow: 0 0 10px 3px rgba(100, 100, 255, 0.6); }
    50%  { border-color: rgba(255, 100, 100, 0.8); box-shadow: 0 0 10px 3px rgba(255, 100, 100, 0.6); }
    75%  { border-color: rgba(100, 255, 100, 0.8); box-shadow: 0 0 10px 3px rgba(100, 255, 100, 0.6); }
    100% { border-color: rgba(255, 255, 255, 0.7); box-shadow: 0 0 8px 2px rgba(255, 255, 255, 0.5); }
}
/* ---- HẾT CODE MỚI ---- */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Be Vietnam Pro', sans-serif;
    color: white;
    background-color: #222;
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('background.jpg'); /* Nhớ kiểm tra đuôi file ảnh */
    background-size: cover; background-position: center; background-attachment: fixed;
    min-height: 100vh; padding-top: 80px; overflow-x: hidden;
}

/* Menu */
.main-nav { position: fixed; top: 0; left: 0; width: 100%; padding: 10px 20px; background: rgba(0, 0, 0, 0.2); backdrop-filter: blur(5px); border-bottom: 1px solid rgba(255, 255, 255, 0.1); z-index: 100; }
.main-nav ul { display: flex; justify-content: space-around; list-style: none; max-width: 600px; margin: 0 auto; position: relative; }
.main-nav .nav-link { color: white; text-decoration: none; font-weight: 500; padding: 10px 15px; border-radius: 10px; transition: color 0.3s ease; cursor: pointer; position: relative; z-index: 2; }
.main-nav .nav-link:hover, .main-nav .nav-link.active { color: #ffffff; }
.nav-indicator { position: absolute; top: 0; height: 100%; background: rgba(255, 255, 255, 0.2); border-radius: 10px; z-index: 1; transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Chuyển trang */
.page-wrapper { position: relative; }
.page-content { display: none; opacity: 0; transition: opacity 0.4s ease-in-out; }
.page-content.active { display: block; opacity: 1; animation: fadeIn 0.5s ease-out forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Khung nội dung */
.container { width: 100%; max-width: 500px; margin: 40px auto 0 auto; text-align: center; padding: 30px; background: rgba(255, 255, 255, 0.1); border-radius: 20px; backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.2); box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3); position: relative; }

/* Nút Sáng/Tối */
.theme-toggle-btn { position: absolute; top: 20px; right: 20px; z-index: 10; width: 44px; height: 44px; border-radius: 50%; border: none; background: rgba(255, 255, 255, 0.2); color: white; cursor: pointer; font-size: 1.2rem; display: flex; justify-content: center; align-items: center; transition: all 0.3s ease; }
.theme-toggle-btn:hover { background: rgba(255, 255, 255, 0.4); }
.theme-toggle-btn:active { transform: scale(0.9); }
.theme-toggle-btn .fa-moon { display: none; }
.dark-theme .theme-toggle-btn .fa-sun { display: none; }
.dark-theme .theme-toggle-btn .fa-moon { display: block; }

/* ---- TRÌNH PHÁT NHẠC ---- */
.music-player { position: absolute; top: 20px; left: 20px; z-index: 10; display: flex; align-items: center; padding: 8px; background: rgba(0, 0, 0, 0.3); border-radius: 12px; backdrop-filter: blur(3px); border: 1px solid rgba(255, 255, 255, 0.1); width: auto; max-width: calc(100% - 80px); /* Đảm bảo ko chạm nút sáng/tối */ cursor: pointer; transition: background 0.3s ease; overflow: hidden; }
.music-player:hover { background: rgba(0, 0, 0, 0.4); }

/* Wrapper Ảnh + Visualizer + Lớp phủ tối */
.art-visualizer-wrapper {
    position: relative; width: 40px; height: 40px; margin-right: 12px;
    flex-shrink: 0; border-radius: 8px; overflow: visible; /* Cho glow hiện ra */
    /* Lớp phủ tối */
    &::after {
        content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
        background-color: rgba(0, 0, 0, 0.5); opacity: 0; transition: opacity 0.3s ease;
        z-index: 2; pointer-events: none; border-radius: inherit;
    }
    &.dimmed::after { opacity: 1; }
}

/* Ảnh bìa (BỎ NẢY, THÊM GLOW CHẠY) */
.music-player-art {
    width: 100%; height: 100%;
    object-fit: cover; border: none; display: block;
    border-radius: inherit;
    /* Viền tĩnh mờ khi dừng */
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 5px 1px rgba(255, 255, 255, 0.3);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    /* Xóa animation cũ */
    animation: none;
}
/* ---- Kích hoạt glow chạy khi nhạc phát ---- */
.music-player.playing .music-player-art {
    /* box-shadow và border-color sẽ do animation điều khiển */
    animation: rotating-border-glow 4s linear infinite;
}

/* Visualizer (Đè lên ảnh) */
.music-player-visualizer { position: absolute; bottom: 0; left: 0; width: 100%; z-index: 3; display: flex; align-items: flex-end; justify-content: center; height: 60%; gap: 2px; padding: 2px 4px; pointer-events: none; opacity: 0; /* Mặc định ẩn */}
.music-player-visualizer .bar { width: 3px; height: 100%; border-radius: 1.5px; background: white; transform-origin: bottom; transform: scaleY(0.2); opacity: 0.9; transition: transform 0.2s ease; }
/* Hiện và kích hoạt animation khi có class .active */
.music-player-visualizer.active { opacity: 1; }
.music-player.playing .music-player-visualizer.active .bar { animation-name: bounce-bar; animation-iteration-count: infinite; }
.music-player.playing .music-player-visualizer.active .bar:nth-child(1) { animation-duration: 0.6s; animation-delay: 0.1s; }
.music-player.playing .music-player-visualizer.active .bar:nth-child(2) { animation-duration: 0.8s; animation-delay: 0.3s; }
.music-player.playing .music-player-visualizer.active .bar:nth-child(3) { animation-duration: 0.7s; animation-delay: 0.2s; }

/* ---- CSS CHO CHỮ CHẠY (ĐÃ SỬA LẠI HOÀN CHỈNH) ---- */
.music-player-info {
    text-align: left;
    overflow: hidden; /* Quan trọng nhất: Giấu phần tràn ra ngoài của chính nó */
    flex-grow: 1;     /* Cho phép nó chiếm phần không gian còn lại */
    position: relative; /* Cần thiết cho marquee hoạt động đúng */
}
/* Container chứa marquee-text */
.song-title, .song-artist {
    /* overflow: hidden; Đã chuyển lên cha */
    white-space: nowrap;
    position: relative;
    width: 100%; /* Đảm bảo nó không bị co lại */
}
.song-title { font-size: 0.9rem; font-weight: 500; margin-bottom: 2px; }
.song-artist { font-size: 0.75rem; font-weight: 300; opacity: 0.8; }

/* Khối marquee */
.marquee-text {
    display: inline-block; /* Quan trọng */
    white-space: nowrap;
    /* Reset transform khi không chạy */
    transform: translateX(0);
    /* Xóa animation */
    animation: none;
    will-change: transform;
    /* Thêm padding để tạo khoảng dừng ở đầu */
    padding-left: 0;
    transition: none; /* Bỏ transition padding-left */
}
/* Span chứa chữ */
.marquee-text span {
    display: inline-block;
    padding-right: 30px; /* Khoảng cách lặp */
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    /* Reset animation */
    animation: none;
}

/* Kích hoạt animation khi có class scrolling */
.marquee-text.scrolling {
    display: inline-block; /* Quan trọng */
    /* Áp dụng animation cho DIV marquee-text */
    animation-name: marquee;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    /* animation-duration sẽ được set bằng JS */
    /* Xóa padding-left khi chạy */
    padding-left: 0 !important;
}

/* Phần nhân đôi (::after) - Chỉ hiện khi đang scrolling */
.marquee-text.scrolling::after {
    content: attr(data-content); /* Lấy nội dung từ data-content */
    display: inline-block; /* Quan trọng */
    position: absolute; /* Đặt chồng lên */
    left: 100%;        /* Bắt đầu ngay sau padding-right của span */
    top: 0;
    white-space: nowrap;
    padding-left: 30px; /* Khoảng cách với span */
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    /* Thêm các thuộc tính giống span để đảm bảo font,... */
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    opacity: inherit;
}
/* ---- HẾT CSS CHỮ CHẠY ---- */


/* Nút bấm ẩn */
.play-pause-overlay-btn { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: transparent; border: none; cursor: pointer; outline: none; z-index: 5; }
/* ---- HẾT CSS TRÌNH PHÁT NHẠC ---- */

/* Ảnh đại diện */
.avatar { width: 120px; height: 120px; border-radius: 50%; border: 4px solid white; object-fit: cover; box-shadow: 0 0 20px rgba(255, 255, 255, 0.5); margin-top: 80px; }

/* Username, Description, Links, Link-button */
.username { font-size: 2rem; font-weight: 700; margin-top: 15px; text-shadow: 0 0 10px rgba(0, 0, 0, 0.5); }
.description { font-size: 1rem; font-weight: 300; margin-top: 5px; margin-bottom: 30px; }
.links { display: flex; flex-direction: column; gap: 15px; }
.link-button { display: flex; align-items: center; padding: 12px 20px; gap: 15px; text-decoration: none; color: white; font-size: 1rem; font-weight: 500; border-radius: 50px; background: rgba(255, 255, 255, 0.2); border: 1px solid rgba(255, 255, 255, 0.3); transition: all 0.3s ease; }
.link-button:hover { background: rgba(255, 255, 255, 0.4); transform: scale(1.02); box-shadow: 0 0 15px rgba(255, 255, 255, 0.5); }
.link-icon { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: white; }
.facebook:hover { background-color: #1877F2; border-color: #1877F2; }
.tiktok:hover   { background-color: #000000; border-color: #000000; }
.youtube:hover  { background-color: #FF0000; border-color: #FF0000; }
.zalo:hover     { background-color: #0068FF; border-color: #0068FF; }
.discord:hover  { background-color: #5865F2; border-color: #5865F2; }
.custom-text-box { background: rgba(0, 0, 0, 0.2); border: 1px dashed rgba(255, 255, 255, 0.3); border-radius: 10px; padding: 20px; min-height: 150px; text-align: left; font-size: 0.9rem; line-height: 1.6; }
.custom-text-box p { margin-bottom: 10px; text-shadow: 0 0 5px rgba(0, 0, 0, 0.7); }

/* Footer */
.footer { margin-top: 30px; font-size: 0.8rem; font-weight: 300; opacity: 0.8; text-align: center; }
.footer span { opacity: 0.7; }

/* ---- DARK THEME (Đã sửa lại hoàn chỉnh) ---- */
.dark-theme .container { background: rgba(0, 0, 0, 0.2); border-color: rgba(0, 0, 0, 0.3); }
.dark-theme .link-button { background: rgba(0, 0, 0, 0.2); border-color: rgba(0, 0, 0, 0.3); }
.dark-theme .link-button:hover { background: rgba(0, 0, 0, 0.4); }
.dark-theme .theme-toggle-btn { background: rgba(0, 0, 0, 0.3); }
.dark-theme .theme-toggle-btn:hover { background: rgba(0, 0, 0, 0.5); }
.dark-theme .music-player { background: rgba(50, 50, 50, 0.4); border-color: rgba(50, 50, 50, 0.5); }
.dark-theme .music-player:hover { background: rgba(50, 50, 50, 0.5); }
/* Dark theme cho ảnh bìa (glow tối) */
.dark-theme .music-player-art { box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.3); border-color: rgba(0,0,0,0.3); }
/* Dark theme cho glow chạy (chưa làm, có thể thêm sau nếu muốn) */
/* .dark-theme .music-player.playing .music-player-art { animation: rotating-border-glow-dark 4s linear infinite; } */
.dark-theme .art-visualizer-wrapper::after { background-color: rgba(50, 50, 50, 0.5); }
.dark-theme .music-player-visualizer .bar { background: #BBBBBB; opacity: 0.8; }
.dark-theme .song-title { color: #DDDDDD; }
.dark-theme .song-artist { color: #AAAAAA; }
/* ---- HẾT DARK THEME ---- */