/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --primary-light: #C8E6C9;
    --text-primary: #212121;
    --text-secondary: #757575;
    --bg-color: #f5f5f5;
    --white: #ffffff;
    --sidebar-width: 240px;
    --header-height: 56px;
    --shadow: 0 2px 5px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.15);
    --transition: all 0.3s ease;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-color);
}

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

ul {
    list-style: none;
}

/* 顶部导航栏 */
.head-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--primary-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 100;
    box-shadow: var(--shadow);
}

.head-bar .icon-menu,
.head-bar .icon-user {
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.head-bar .icon-menu:hover,
.head-bar .icon-user:hover {
    background: rgba(255,255,255,0.2);
}

.search-bar {
    flex: 1;
    margin: 0 16px;
    position: relative;
}

.search-bar .icon-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-bar input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 40px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    background: var(--white);
    outline: none;
    transition: var(--transition);
}

.search-bar input:focus {
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: -var(--sidebar-width);
    width: var(--sidebar-width);
    height: calc(100% - var(--header-height));
    background: var(--white);
    box-shadow: var(--shadow);
    transition: var(--transition);
    z-index: 90;
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-text {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.nav-menu {
    padding: 0 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-primary);
    transition: var(--transition);
    margin-bottom: 4px;
}

.nav-link:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.nav-link.active {
    background: var(--primary-color);
    color: var(--white);
}

.nav-link i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.mini-app-promo {
    padding: 16px;
    text-align: center;
    border-top: 1px solid #eee;
}

.promo-title {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 500;
}

.promo-qrcode {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    display: block;
    margin: 0 auto 10px;
}

.promo-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #eee;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.footer-links a {
    font-size: 12px;
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--primary-color);
}

.copyright {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 遮罩层 */
.overlay {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 80;
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 主内容区 */
.main-content {
    margin-top: var(--header-height);
    padding: 16px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* 标签页 */
.tabs-container {
    margin-bottom: 16px;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.tabs {
    display: flex;
    border-bottom: 2px solid #eee;
}

.tab {
    padding: 14px 24px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    position: relative;
}

.tab:hover {
    color: var(--primary-color);
    background: var(--primary-light);
}

.tab.active {
    color: var(--primary-color);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

/* 字母导航 */
.letter-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px;
    background: var(--white);
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.letter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    background: var(--bg-color);
}

.letter-btn:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.letter-btn.active {
    background: var(--primary-color);
    color: var(--white);
}

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

.song-item {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.song-item:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.song-item a {
    display: block;
    padding: 16px;
}

.song-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.song-info {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
}

.song-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 4px;
    font-size: 12px;
}

/* 加载更多 */
.load-more {
    text-align: center;
    padding: 24px;
}

.load-more-btn {
    padding: 12px 32px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 24px;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.load-more-btn:hover {
    background: var(--primary-dark);
}

.load-more-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 搜索弹窗 */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding-top: 80px;
    z-index: 200;
}

.search-modal.show {
    display: flex;
}

.search-modal-content {
    background: var(--white);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 70vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.search-modal-header h3 {
    font-size: 16px;
    color: var(--text-primary);
}

.close-modal {
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}

.close-modal:hover {
    color: var(--text-primary);
}

#search-results {
    padding: 16px;
    max-height: calc(70vh - 60px);
    overflow-y: auto;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
        left: -280px;
    }

    .main-content {
        padding: 12px;
    }

    .song-list {
        grid-template-columns: 1fr;
    }

    .tab {
        padding: 12px 16px;
        font-size: 13px;
    }

    .letter-btn {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
}

@media (min-width: 1024px) {
    .sidebar {
        left: 0;
    }

    .main-content {
        margin-left: var(--sidebar-width);
    }

    .overlay {
        display: none;
    }

    #menu-btn {
        display: none;
    }
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.song-item {
    animation: fadeIn 0.3s ease;
}

/* 字母导航数字标记 */
.letter-btn sup {
    font-size: 10px;
    margin-left: 2px;
    opacity: 0.7;
}

/* 图片弹窗 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 300;
    padding: 20px;
}

.image-modal.show {
    display: flex;
}

.image-modal-content {
    background: var(--white);
    border-radius: 12px;
    max-width: 95vw;
    max-height: 95vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
}

.image-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    background: var(--primary-color);
    color: var(--white);
}

.image-modal-header h3 {
    font-size: 16px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 16px;
}

.image-modal-close {
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: var(--transition);
}

.image-modal-close:hover {
    opacity: 1;
}

.image-modal-body {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: #f0f0f0;
}

.image-modal-img {
    max-width: 100%;
    max-height: calc(95vh - 140px);
    object-fit: contain;
    border-radius: 4px;
    box-shadow: var(--shadow);
}

.image-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #eee;
    text-align: center;
}

.image-modal-download {
    display: inline-block;
    padding: 10px 24px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 20px;
    font-size: 14px;
    text-decoration: none;
    transition: var(--transition);
}

.image-modal-download:hover {
    background: var(--primary-dark);
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading p::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 错误状态 */
.error-state {
    text-align: center;
    padding: 40px;
    color: #f44336;
}