/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'SF Pro Display', 'Segoe UI', Helvetica, Arial, sans-serif;
}

:root {
    --primary-color: #6A11CB;
    --secondary-color: #2575FC;
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --border-radius: 8px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.app-container {
    display: grid;
    grid-template-areas:
        "sidebar main"
        "player player";
    grid-template-rows: 1fr 80px;
    grid-template-columns: 240px 1fr;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* 侧边栏样式 */
.sidebar {
    grid-area: sidebar;
    background-color: rgba(20, 20, 20, 0.9);
    padding: 20px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.logo h1 {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 30px;
    font-size: 24px;
}

.nav-links li {
    list-style: none;
    padding: 12px 15px;
    margin-bottom: 5px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-links li:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-links li.active {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-weight: 500;
}

.room-status {
    margin-top: auto;
    padding: 15px;
    background-color: rgba(42, 42, 42, 0.7);
    border-radius: var(--border-radius);
}

.hidden {
    display: none;
}

/* 主内容区样式 */
.main-content {
    grid-area: main;
    padding: 20px;
    overflow-y: auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* 搜索栏样式 */
.search-container {
    display: flex;
    margin-bottom: 30px;
}

.search-bar {
    flex: 1;
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    overflow: hidden;
    backdrop-filter: blur(5px);
}

.search-bar input {
    flex: 1;
    padding: 12px 15px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
}

.search-bar input:focus {
    outline: none;
}

.search-bar button {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0 15px;
    cursor: pointer;
}

.source-selector {
    margin-left: 10px;
}

.source-selector select {
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: none;
    border-radius: var(--border-radius);
    appearance: none;
    padding-right: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
}

.source-selector select:focus {
    outline: none;
}

/* 音乐列表样式 */
.music-list {
    margin-bottom: 40px;
}

.music-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.music-item:hover {
    background-color: rgba(42, 42, 42, 0.7);
    transform: translateY(-2px);
}

.music-thumbnail {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 15px;
}

.music-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.music-info {
    flex: 1;
}

.music-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.music-artist {
    font-size: 14px;
    color: var(--text-secondary);
}

.music-actions {
    display: flex;
    align-items: center;
}

.music-actions button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    font-size: 16px;
    transition: color 0.2s ease;
}

.music-actions button:hover {
    color: var(--text-primary);
}

.empty-message, .loading {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-style: italic;
}

/* 播放器控制区样式 */
.player-container {
    grid-area: player;
    background-color: rgba(20, 20, 20, 0.95);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

.current-track {
    display: flex;
    align-items: center;
    width: 240px;
}

.album-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 15px;
}

.album-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.track-info {
    flex: 1;
    overflow: hidden;
}

#current-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#current-artist {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.favorite-btn {
    margin-left: 15px;
    cursor: pointer;
    font-size: 18px;
}

.favorite-btn .fas.fa-heart {
    color: #e91e63;
}

.player-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 20px;
}

.progress-container {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 10px;
}

#current-time, #total-time {
    font-size: 12px;
    color: var(--text-secondary);
    width: 45px;
}

#current-time {
    text-align: right;
}

#total-time {
    text-align: left;
}

.progress-bar {
    flex: 1;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 0 10px;
    cursor: pointer;
    position: relative;
}

#progress {
    height: 100%;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
    width: 0%;
    position: relative;
}

.control-buttons {
    display: flex;
    align-items: center;
}

.control-buttons button {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 16px;
    padding: 8px 15px;
}

#play-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 15px;
}

.volume-control {
    display: flex;
    align-items: center;
    margin-left: 20px;
}

.volume-control i {
    margin-right: 10px;
    color: var(--text-secondary);
}

#volume-slider {
    -webkit-appearance: none;
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
}

/* 播放详情页/歌词页样式 */
.player-details {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 20;
    display: none;
    flex-direction: column;
    padding: 20px;
}

.player-details.show {
    display: flex;
}

.details-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.details-header button {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
}

.details-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    flex: 1;
}

.album-art {
    width: 300px;
    height: 300px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.album-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.track-details {
    text-align: center;
    margin-bottom: 30px;
}

.track-details h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.track-details h3 {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.track-details p {
    font-size: 14px;
    color: var(--text-secondary);
}

.lyrics-container {
    width: 100%;
    max-width: 500px;
    text-align: center;
    margin-top: 20px;
}

#lyrics {
    line-height: 2;
}

#lyrics p {
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

#lyrics p.active {
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 500;
}

.no-lyrics {
    color: var(--text-secondary);
    font-style: italic;
}

/* 一起听页面样式 */
.listen-together-container {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

.create-room, .join-room {
    flex: 1;
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.create-room h3, .join-room h3 {
    margin-bottom: 15px;
    font-size: 20px;
}

.create-room p, .join-room p {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.room-input {
    display: flex;
    width: 100%;
    margin-top: 10px;
}

.room-input input {
    flex: 1;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    color: var(--text-primary);
    font-size: 16px;
    text-align: center;
    letter-spacing: 2px;
}

.room-input button {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-danger {
    background-color: #e91e63;
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.room-info h3 {
    margin-bottom: 10px;
}

#room-id {
    font-weight: 700;
    letter-spacing: 2px;
}