/* style.css - 最终修复版 (已将循环按钮定位调整为 0.5rem) */

/* 全局样式和重置 */
:root {
    --primary-pink: #FFB6C1; /* 淡粉色 */
    --secondary-pink: #FF69B4; /* 热门粉色 */
    --light-pink: #FFE4E1; /* 浅粉色，背景或边框 */
    --text-color-dark: #333;
    --text-color-light: #fff;
    --card-background: #FFF0F5; /* 花瓣粉 */
    --border-color: #FFC0CB; /* 粉红色，边框 */
    --hover-color: #FFDAB9; /* 桃色，用于悬停效果 */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Arial', sans-serif; /* 可以替换为更可爱的字体 */
    background-color: var(--light-pink);
    color: var(--text-color-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* 确保页脚固定在底部 */
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: inherit;
}

/* 头部样式 */
.header {
    background-color: var(--primary-pink);
    color: var(--text-color-light);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center; /* 左右两边对齐 */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky; /* 使导航栏固定在顶部 */
    top: 0;
    z-index: 1000; /* 确保在其他内容之上 */
}

.site-title {
    font-size: 1.8rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.nav-list {
    display: flex;
    gap: 1.5rem;
}

.nav-item a {
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.nav-item a:hover,
.nav-item a.active {
    background-color: var(--secondary-pink);
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* 主要内容区域 */
.main-content {
    flex-grow: 1; /* 填充可用空间，将页脚推到底部 */
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.page {
    display: none; /* 默认隐藏所有页面 */
    padding: 1.5rem;
    background-color: var(--card-background);
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.page.active {
    display: block; /* 激活的页面显示 */
}

.page h2 {
    color: var(--secondary-pink);
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.05);
}

/* 歌曲列表容器 */
.song-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* 歌曲卡片样式 */
.song-card {
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.song-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    background-color: var(--hover-color); /* 悬停背景色 */
}

.song-card-cover {
    width: 120px;
    height: 120px;
    border-radius: 50%; /* 圆形头像 */
    object-fit: cover;
    margin-bottom: 0.8rem;
    border: 3px solid var(--primary-pink); /* 粉色边框 */
}

/* 当前播放页面样式 */
.player-container {
    /* 核心改动：为绝对定位的按钮提供定位上下文 */
    position: relative; 
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #fff;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 0 auto;
}

.player-cover {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 0 0 5px var(--primary-pink); /* 粉色光环 */
    position: relative; 
}

.player-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease-out;
}

/* 定义旋转动画 */
@keyframes rotateDisk {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 应用旋转动画的类 */
.player-cover img.rotating {
    animation: rotateDisk 15s linear infinite; 
}

/* 循环按钮新样式 - 隐性化和绝对定位 (卡片右上角) */
.loop-btn-absolute {
    position: absolute;
    /* 定位到卡片的右上角 (相对于 player-container) */
    top: 2rem;     /* 等于 player-container 的 padding-top */
    right: 2rem;   /* 等于 player-container 的 padding-right */
    
    width: 40px; 
    height: 40px; 
    border-radius: 50%;
    background-color: #fff; /* 跟卡片同色 (白色) */
    color: #999; /* 图标灰色，较为隐性 */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); 
    display: flex; /* 居中 SVG */
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    z-index: 10; 
}

.loop-btn-absolute svg {
    width: 22px;
    height: 22px;
}

.loop-btn-absolute:hover {
    background-color: var(--hover-color);
    transform: scale(1.05); 
    color: var(--text-color-dark); /* 悬停时图标变深 */
}

/* 【核心修复】：防止循环按钮在点击(active)或获得焦点(focus)时出现实心圆遮盖图标 */
.loop-btn-absolute:focus,
.loop-btn-absolute:active {
    /* 确保背景色是白色，与卡片背景融合，防止浏览器或默认样式覆盖 */
    background-color: #fff; 
    /* 确保 box-shadow 保持不变 */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); 
    outline: none; /* 移除浏览器默认的轮廓 */
    color: #999; 
    transform: none; /* 移除点击时的 transform 变化 */
}

/* 激活状态（单曲循环）的样式 */
.loop-btn-absolute.active-loop {
    color: var(--secondary-pink); /* 激活时使用粉色 */
}

/* 播放控制按钮的点击/焦点样式（保持实心效果） */
.control-btn:focus,
.control-btn:active {
    outline: none;
    background-color: var(--secondary-pink); 
    transform: scale(1.05); 
}

.player-info {
    text-align: center;
    margin-bottom: 1.5rem;
}

.current-song-title {
    font-size: 1.8rem;
    color: var(--secondary-pink);
    margin-bottom: 0.5rem;
}

.current-artist {
    font-size: 1.2rem;
    color: #555;
}

.player-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-bottom: 1.5rem;
}

.control-buttons {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.control-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary-pink);
    color: var(--text-color-light);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.control-btn svg {
    width: 28px;
    height: 28px;
}

.control-btn:hover {
    background-color: var(--secondary-pink);
    transform: scale(1.05);
}

.progress-bar-container {
    display: flex;
    align-items: center;
    width: 80%;
    gap: 10px;
    margin-bottom: 1rem;
}

.current-time, .total-time {
    font-size: 0.9rem;
    color: #777;
    min-width: 40px; /* 确保时间显示完整 */
    text-align: center;
}

.progress-bar {
    flex-grow: 1;
    -webkit-appearance: none; 
    appearance: none;
    height: 8px;
    border-radius: 5px;
    background: var(--light-pink);
    outline: none;
    transition: opacity .2s;
    cursor: pointer;
}

.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--secondary-pink);
    cursor: grab;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
}

.progress-bar::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--secondary-pink);
    cursor: grab;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
}

/* 歌词容器样式 - 自动上移，占用更多空间 */
.lyrics-container {
    width: 100%; 
    height: 350px; 
    overflow-y: auto; 
    background-color: #fcfcfc;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.5rem; 
    text-align: center;
    font-size: 1.2rem; 
    color: #555;
    line-height: 1.8;
    margin-top: 1.5rem;
    position: relative; 
    transition: box-shadow 0.3s ease;
}

.lyrics-container:hover {
    box-shadow: 0 0 10px rgba(255, 105, 180, 0.5); 
}

.lyrics-content {
    position: relative; 
}

.lyrics-content p {
    margin-bottom: 0.6rem; 
    transition: color 0.3s ease, font-weight 0.3s ease, transform 0.3s ease;
    padding: 3px 0; 
}

.lyrics-content p.active-lyric {
    color: var(--secondary-pink);
    font-weight: bold;
    transform: scale(1.05);
    text-shadow: 0 0 5px rgba(255, 105, 180, 0.3); 
}

/* 页脚样式 */
.footer {
    background-color: var(--primary-pink);
    color: var(--text-color-light);
    text-align: center;
    padding: 1rem;
    margin-top: auto; 
    width: 100%;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

/* ---------------------------------------------------- */
/* 响应式设计 - 手机版优化 (max-width: 768px) */
/* ---------------------------------------------------- */
@media (max-width: 768px) {
    /* ... (省略非当前播放页面的样式) ... */
    .header {
        flex-direction: column;
        padding: 0.8rem 1rem;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .site-title {
        width: 100%;
        text-align: center;
        margin-bottom: 0;
        font-size: 1.6rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    }
    .nav {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        padding-top: 0.5rem;
    }
    .nav-list {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.8rem;
        padding: 0;
        width: auto;
    }
    .nav-item {
        flex-shrink: 0; 
    }
    .nav-item a {
        padding: 0.4rem 0.8rem;
        font-size: 0.95rem;
        display: inline-block;
        min-width: 80px;
        white-space: nowrap;
    }
    .main-content {
        padding: 1rem;
    }
    .page {
        padding: 1rem;
    }
    .page h2 {
        font-size: 1.8rem;
    }
    .song-list-container {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.8rem;
    }
    .song-card {
        padding: 0.6rem;
    }
    .song-card-cover {
        width: 80px;
        height: 80px;
        margin-bottom: 0.5rem;
    }
    .song-card-title {
        font-size: 1rem;
    }
    .song-card-artist {
        font-size: 0.85rem;
    }


    /* ************************************************* */
    /* *** 当前播放卡片紧凑优化和高度调整 (768px) *** */
    /* ************************************************* */
    .player-container {
        padding-top: 1.2rem;
        padding-bottom: 0.5rem; 
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .player-cover {
        width: 100px; 
        height: 100px;
        margin-bottom: 1.2rem; /* 头像到歌名距离 = 1.2rem */
    }
    
    /* 手机版循环按钮定位调整 */
    .loop-btn-absolute {
        top: 1.2rem;     /* 【核心调整】：设置为 0.5rem */
        right: 1.2rem;   /* 【核心调整】：设置为 0.5rem */
        width: 30px; 
        height: 30px;
    }
    .loop-btn-absolute svg {
        width: 18px; 
        height: 18px;
    }

    .current-song-title {
        font-size: 1.4rem; 
        margin-bottom: 0.1rem; 
    }

    .current-artist {
        font-size: 1rem; 
        margin-bottom: 0.5rem; 
    }

    .control-buttons {
        gap: 1rem; 
        margin-bottom: 0.5rem; 
    }

    .control-btn {
        width: 35px; 
        height: 35px;
    }

    .control-btn svg {
        width: 20px; 
        height: 20px;
    }

    /* 进度条位置优化 */
    .progress-bar-container {
        width: 95%; 
        margin-top: 0.8rem; 
        margin-bottom: 0.8rem; 
    }

    .current-time, .total-time {
        font-size: 0.75rem; 
        min-width: 35px; 
    }

    /* 歌词框高度调整 */
    .lyrics-container {
        height: 300px; 
        font-size: 0.95rem; 
        padding: 0.8rem; 
        margin-top: 0.5rem; 
    }
    .lyrics-content p.active-lyric {
        font-size: 1.05rem; 
    }
}

/* ---------------------------------------------------- */
/* 响应式设计 - 超窄屏手机优化 (max-width: 480px) */
/* ---------------------------------------------------- */
@media (max-width: 480px) {
    /* ... (省略非当前播放页面的样式) ... */
    .site-title {
        font-size: 1.3rem;
    }
    .nav-item a {
        font-size: 0.9rem;
        padding: 0.4rem 0.7rem;
        min-width: 70px;
    }
    
    /* ************************************************* */
    /* *** 当前播放卡片紧凑优化和高度调整 (480px) *** */
    /* ************************************************* */
    .player-container {
        padding-top: 1.2rem; 
    }
    .player-cover {
        margin-bottom: 1.2rem; 
    }
    .loop-btn-absolute {
        top: 0.5rem;    /* 匹配 768px 的调整 */
        right: 0.5rem;  /* 匹配 768px 的调整 */
    }
    .current-song-title {
        font-size: 1.3rem; 
    }

    .current-artist {
        font-size: 0.9rem; 
        margin-bottom: 0.5rem; 
    }
    
    .control-buttons {
        margin-bottom: 0.5rem; 
    }
    
    .progress-bar-container {
        margin-top: 0.8rem; 
        margin-bottom: 0.8rem; 
    }
    
    .lyrics-container {
        height: 250px; 
        margin-top: 0.5rem; 
    }
}
