/* ============================================================
   音乐播放器 V1 - 全局样式
   ============================================================ */

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    color: #2d3436;
    background: #f5f6fb;
    -webkit-font-smoothing: antialiased;
}

a { color: #6c5ce7; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶部导航 ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
    gap: 12px;
}

.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.logo-icon {
    width: 32px; height: 32px;
    background: linear-gradient(135deg,#6c5ce7,#00b894);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(108,92,231,.3);
}
.logo-text { color: #2d3436; text-decoration: none; }
.logo-text:hover { text-decoration: none; }

.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a {
    padding: 8px 16px;
    border-radius: 8px;
    color: #636e72;
    font-size: 14px;
    transition: all .2s;
}
.nav a:hover { background: #f1f2f6; color: #6c5ce7; text-decoration: none; }
.nav a.active {
    background: linear-gradient(135deg,#6c5ce7,#00b894);
    color: #fff;
    font-weight: 600;
}

.user-area { display: flex; gap: 6px; align-items: center; }
.btn-link {
    padding: 8px 14px;
    border-radius: 8px;
    color: #636e72;
    font-size: 14px;
}
.btn-link:hover { background: #f1f2f6; color: #6c5ce7; text-decoration: none; }

/* ---------- 主体 ---------- */
.main {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 24px 160px;
}

.section {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(108,92,231,.08);
    margin-bottom: 20px;
}

/* ---------- 英雄区（首页大标题） ---------- */
.hero {
    background: linear-gradient(135deg,#6c5ce7,#00b894);
    color: #fff;
    padding: 24px 32px;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    margin-bottom: 16px;
    text-align: center;
}
.hero h1 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 600;
}
.hero p { margin: 0 0 20px; opacity: .9; font-size: 14px; line-height: 1.6; }
.hero .hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-primary {
    display: inline-block;
    padding: 11px 26px;
    border-radius: 999px;
    background: #fff;
    color: #6c5ce7;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
    text-decoration: none;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,0,0,.2); text-decoration: none; }
.btn-ghost {
    display: inline-block;
    padding: 11px 26px;
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font-weight: 500;
    font-size: 14px;
    border: 1px solid rgba(255,255,255,.5);
    cursor: pointer;
}
.btn-ghost:hover { background: rgba(255,255,255,.15); text-decoration: none; }

/* 在普通 section 中使用的按钮 */
.section .btn-primary,
.section .btn-ghost {
    background: linear-gradient(135deg,#6c5ce7,#00b894);
    color: #fff;
}
.section .btn-ghost {
    background: #fff;
    color: #6c5ce7;
    border: 1px solid #d9d6ff;
}

/* ---------- 音乐行（列表项） ---------- */
.row-music {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    transition: background .2s;
    cursor: pointer;
}
.row-music + .row-music { border-top: 1px solid #f3f3f7; }
.row-music:hover { background: #f7f8fc; }

.row-play {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg,#6c5ce7,#00b894);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    transition: transform .2s;
}
.row-play:hover { transform: scale(1.08); }

.row-cover {
    width: 44px; height: 44px;
    border-radius: 8px;
    background: linear-gradient(135deg,#b2bec3,#dfe6e9) center/cover no-repeat #ddd;
    flex-shrink: 0;
}

.row-info { flex: 1; min-width: 0; }
.row-title { font-size: 14px; font-weight: 600; color: #2d3436; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-artist { font-size: 12px; color: #888; margin-top: 3px; }
.tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
}
.tag-local    { background: #e7f8ef; color: #00b894; }
.tag-netease  { background: #fee; color: #e74c3c; }
.tag-kugou    { background: #e8f1ff; color: #3498db; }

.btn-del {
    padding: 6px 14px;
    border-radius: 8px;
    background: #fdecea;
    color: #e74c3c;
    border: none;
    cursor: pointer;
    font-size: 13px;
}
.btn-del:hover { background: #f8d7da; }

/* ---------- 播放器底栏 ---------- */
.player {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 -4px 20px rgba(0,0,0,.06);
    z-index: 99;
    flex-wrap: wrap;
}

.player-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 240px;
}
.player-cover {
    width: 44px; height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg,#6c5ce7,#00b894) center/cover no-repeat;
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
}
.player-meta { min-width: 0; }
.player-title { font-size: 14px; font-weight: 600; color: #2d3436; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.player-artist { font-size: 12px; color: #888; margin-top: 2px; }

.player-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 300px;
}
.player-controls { display: flex; gap: 12px; align-items: center; }
.btn-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    background: #f5f6fb;
    color: #2d3436;
    font-size: 14px;
    cursor: pointer;
    transition: background .2s;
}
.btn-icon:hover { background: #e7e8f0; }
.btn-play {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg,#6c5ce7,#00b894);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
}
.btn-play:hover { transform: scale(1.08); box-shadow: 0 6px 14px rgba(108,92,231,.35); }

.player-progress {
    width: 100%;
    max-width: 560px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #888;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.progress-bar {
    flex: 1;
    height: 4px;
    background: #e7e8f0;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}
.progress-bar > div {
    height: 100%;
    background: linear-gradient(90deg,#6c5ce7,#00b894);
    width: 0;
    border-radius: 4px;
    transition: width .15s linear;
}

.player-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.player-right input[type=range] {
    width: 100px;
    accent-color: #6c5ce7;
}
.btn-mode {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: none;
    background: #f5f6fb;
    color: #6c5ce7;
    font-size: 14px;
    cursor: pointer;
    transition: background .2s;
}
.btn-mode:hover { background: #e7e8f0; }
.btn-quality {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    color: #636e72;
    font-size: 12px;
    cursor: pointer;
    transition: all .2s;
}
.btn-quality:hover {
    border-color: #6c5ce7;
    color: #6c5ce7;
}

/* ---------- 全平台自适应 ---------- */

/* Windows / macOS / Linux 桌面端 */
@media screen and (min-width: 1024px) {
    .topbar { padding: 12px 32px; }
    .main { padding: 20px 40px 120px; }
    .hero { padding: 48px 40px; }
    .player { padding: 14px 32px; }
    .player-left { min-width: 280px; }
    .player-center { min-width: 400px; }
    .player-right { display: flex; }
    .section { padding: 24px; }
}

/* Windows / macOS 小窗口笔记本 */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .topbar { padding: 12px 24px; }
    .main { padding: 16px 24px 140px; }
    .hero { padding: 36px 28px; }
    .player { padding: 12px 24px; }
    .player-left { min-width: 200px; }
    .player-center { min-width: 280px; }
    .player-right { display: flex; }
}

/* iPad / Android 平板 */
@media screen and (min-width: 600px) and (max-width: 1023px) and (orientation: landscape) {
    .player { padding: 12px 24px; gap: 20px; }
    .player-left { min-width: 240px; }
    .player-center { min-width: 320px; }
    .btn-mode, .btn-quality { display: inline-flex; }
}

/* iPad 竖屏 / 大屏手机 */
@media screen and (min-width: 600px) and (max-width: 767px) {
    .topbar { padding: 12px 20px; }
    .main { padding: 16px 20px 160px; }
    .hero { padding: 32px 24px; }
    .hero h1 { font-size: 24px; }
    .player { padding: 12px 20px; }
    .player-left { min-width: 160px; }
    .player-center { min-width: 200px; }
    .player-right { display: none; }
}

/* iPhone / Android 手机 竖屏 */
@media screen and (max-width: 599px) {
    .topbar { padding: 10px 16px; flex-wrap: wrap; gap: 8px; }
    .topbar .logo { font-size: 16px; }
    .topbar .nav { order: 3; width: 100%; display: flex; justify-content: center; gap: 4px; }
    .topbar .nav a { padding: 6px 12px; font-size: 13px; }
    .topbar .user-area { margin-left: auto; }
    .main { padding: 12px 12px 180px; }
    .hero { padding: 24px 16px; margin-bottom: 16px; }
    .hero h1 { font-size: 20px; margin-bottom: 10px; }
    .hero p { font-size: 13px; }
    .hero-actions { flex-direction: column; gap: 8px; }
    .hero-actions a { width: 100%; text-align: center; }
    .section { padding: 16px; margin-bottom: 12px; }
    
    /* 播放器优化 - 手机底部固定 */
    .player {
        padding: 10px 12px;
        gap: 8px;
        flex-wrap: nowrap;
    }
    .player-left {
        min-width: 0;
        flex: 0 0 auto;
    }
    .player-cover {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    .player-title {
        font-size: 13px;
        max-width: 120px;
    }
    .player-artist {
        font-size: 11px;
    }
    .player-center {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .player-controls {
        gap: 8px;
    }
    .btn-icon {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    .btn-play {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }
    .btn-mode, .btn-quality {
        width: 28px;
        height: 28px;
        font-size: 11px;
        padding: 0;
    }
    .player-progress {
        width: 100%;
        font-size: 11px;
    }
    .progress-bar {
        height: 3px;
    }
    .player-right {
        display: none;
    }
    
    /* 音乐列表优化 */
    .row-music {
        padding: 10px 12px;
        gap: 10px;
    }
    .row-play {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    .row-cover {
        width: 44px;
        height: 44px;
    }
    .row-title {
        font-size: 14px;
    }
    .row-artist {
        font-size: 12px;
    }
}

/* iPhone / Android 手机 横屏 */
@media screen and (max-width: 599px) and (orientation: landscape) {
    .player {
        flex-wrap: nowrap;
        padding: 8px 16px;
    }
    .player-left {
        min-width: 140px;
        flex: 0 0 auto;
    }
    .player-cover {
        width: 36px;
        height: 36px;
    }
    .player-center {
        flex: 1;
        min-width: 0;
    }
    .player-controls {
        gap: 10px;
    }
    .btn-icon { width: 30px; height: 30px; }
    .btn-play { width: 36px; height: 36px; }
    .btn-mode, .btn-quality { width: 26px; height: 26px; }
    .main { padding: 8px 16px 100px; }
    .hero { padding: 16px 20px; margin-bottom: 12px; }
    .hero h1 { font-size: 18px; }
}

/* iPad 平板 - 竖屏 */
@media screen and (min-width: 600px) and (max-width: 1023px) and (orientation: portrait) {
    .main { padding: 16px 20px 160px; }
    .player { padding: 12px 20px; }
    .player-left { min-width: 180px; }
    .player-center { min-width: 240px; }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .btn-icon:hover,
    .btn-play:hover,
    .btn-mode:hover,
    .btn-quality:hover {
        transform: none;
    }
    .btn-icon:active,
    .btn-play:active,
    .btn-mode:active,
    .btn-quality:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
    .row-music:hover {
        background: transparent;
    }
    .row-music:active {
        background: #f7f8fc;
    }
}

/* 安全区域适配 - iPhone X 及以上 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .player {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
    @media screen and (max-width: 599px) {
        .player {
            padding-left: calc(12px + env(safe-area-inset-left));
            padding-right: calc(12px + env(safe-area-inset-right));
        }
    }
}

/* 鸿蒙系统特殊适配 */
@supports (-webkit-touch-callout: none) or (not (overflow: -webkit-page-scroll)) {
    .player {
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
    }
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    .player {
        background: rgba(30, 30, 30, 0.95);
        border-top-color: #333;
    }
    .player-title { color: #fff; }
    .player-artist { color: #aaa; }
    .btn-icon { background: #333; color: #fff; }
    .btn-mode { background: #333; color: #6c5ce7; }
}

/* 小工具类 */
.text-center { text-align: center; }
.muted { color: #888; font-size: 13px; }
.mt-2 { margin-top: 16px; }
code {
    background: #f1f2f6;
    color: #2d3436;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: Consolas, Menlo, monospace;
    font-size: 13px;
}

/* ---------- 用户页面样式 ---------- */
.user-card {
    background: linear-gradient(135deg,#6c5ce7,#00b894);
    color: #fff;
    padding: 24px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
}
.user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
}
.user-info h2 {
    margin: 0 0 4px;
    font-size: 20px;
}
.user-info p {
    margin: 0;
    opacity: .8;
    font-size: 14px;
}
.btn-edit {
    margin-left: auto;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255,255,255,.2);
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: background .2s;
}
.btn-edit:hover { background: rgba(255,255,255,.3); }

.my-section {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(108,92,231,.08);
}
.my-section h3 {
    margin: 0 0 16px;
    font-size: 16px;
    color: #2d3436;
}
.my-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.my-item {
    background: #f7f8fc;
    border-radius: 12px;
    padding: 20px 12px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    position: relative;
}
.my-item:hover {
    background: #f1f2f6;
    transform: translateY(-2px);
}
.my-icon {
    font-size: 28px;
    margin-bottom: 8px;
}
.my-text {
    font-size: 14px;
    color: #2d3436;
}
.my-count {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #6c5ce7;
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
}

.content-section {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(108,92,231,.08);
}
.empty-state {
    text-align: center;
    padding: 40px 20px;
}
.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}
.empty-state p {
    margin: 0 0 16px;
    color: #888;
}

.playlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}
.playlist-item {
    background: #f7f8fc;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
}
.playlist-item:hover {
    background: #f1f2f6;
    transform: translateY(-2px);
}
.playlist-cover {
    width: 120px;
    height: 120px;
    margin: 0 auto 12px;
    background: linear-gradient(135deg,#6c5ce7,#00b894);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}
.playlist-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}
.playlist-count {
    font-size: 12px;
    color: #888;
}

.friend-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f7f8fc;
    border-radius: 12px;
}
.friend-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg,#6c5ce7,#00b894);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
}
.friend-info {
    flex: 1;
}
.friend-name {
    font-size: 14px;
    font-weight: 600;
}
.friend-id {
    font-size: 12px;
    color: #888;
}

/* 弹窗样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
}
.modal-content h3 {
    margin: 0 0 20px;
    font-size: 18px;
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #636e72;
}
.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}
.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}
.btn-cancel {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    color: #636e72;
    font-size: 14px;
    cursor: pointer;
}
.btn-submit {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg,#6c5ce7,#00b894);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

/* 音乐列表 */
.music-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.row-music {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f7f8fc;
    border-radius: 10px;
    cursor: pointer;
    transition: background .2s;
}
.row-music:hover { background: #f1f2f6; }
.row-play {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg,#6c5ce7,#00b894);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
}
.row-cover {
    width: 50px;
    height: 50px;
    background: #e7e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.row-info {
    flex: 1;
    min-width: 0;
}
.row-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.row-artist {
    font-size: 12px;
    color: #888;
}
.row-add {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    color: #6c5ce7;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

/* 移动端适配 */
@media screen and (max-width: 599px) {
    .my-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .user-card {
        padding: 16px;
        flex-direction: column;
        text-align: center;
    }
    .btn-edit {
        margin-left: 0;
        margin-top: 12px;
    }
    .playlist-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
