/* styles.css - 简化版吉他谱网站样式 */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0.5rem;
}

/* 歌曲列表页面 */
.songs-list {
    max-width: 1200px;
    margin: 0 auto;
}

.songs-list h2 {
    color: white;
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.8rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Tag 筛选器 */
.filter-section {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
}

.filter-section label {
    color: white;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.tag-filter {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.tag-filter:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

.tag-filter:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.5);
}

.songs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.song-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.song-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 1);
}

.song-card h3 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.song-card p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.song-card p:last-child {
    margin-bottom: 0;
    color: #888;
    font-size: 0.85rem;
    font-style: italic;
}

/* 歌曲标签 */
.song-tags {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.song-tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.song-tag.loopable {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* 无结果提示 */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    color: #666;
    font-style: italic;
}

/* 吉他谱详情页面 */
.song-display {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    padding-bottom: 0.5rem;
}

/* 顶部控制区域 */
.top-controls {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 6px;
    padding: 0.4rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: 40px;
}

.song-info {
    flex-grow: 1;
    min-width: 0;
    padding: 0.05rem 0.5rem;
    text-align: center;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.song-title {
    color: #333;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    max-width: 200px;
    flex: 1;
}

.song-key-info {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
    font-size: 0.65rem;
    font-weight: 600;
    display: inline-block;
    line-height: 1;
    margin: 0;
    white-space: nowrap;
    background: rgba(102, 126, 234, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.song-key {
    display: none;
}

/* 滚动控制区域 */
.scroll-controls {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 6px;
    padding: 0.6rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 0.5rem;
}

.back-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.4rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 0.6rem;
}

.back-btn:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
}

.speed-btn, .play-btn {
    background: #667eea;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-btn {
    background: #28a745;
    font-size: 0.8rem;
}

.play-btn.playing {
    background: #dc3545;
}

.speed-btn:hover, .play-btn:hover {
    transform: scale(1.1);
}

.speed-display {
    color: #333;
    font-size: 0.75rem;
    font-weight: 500;
    position: absolute;
    right: 6rem;
}

.chord-toggle-btn {
    background: #764ba2;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: absolute;
    right: 0.6rem;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chord-toggle-btn:hover {
    background: #8e5db0;
    transform: scale(1.05);
}

.chord-toggle-btn.active {
    background: #28a745;
}

/* 内容容器 */
.content-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    margin-top: 0.4rem;
}

/* 吉他谱内容 */
.song-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 0.75rem;
    font-family: 'Courier New', Monaco, monospace;
    font-size: 0.85rem;
    line-height: 1.3;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin: 0;
    height: calc(100vh - 180px);
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* 移动端优化 */
@media (max-width: 768px) {
    body {
        padding: 0.25rem;
    }
    
    .songs-list h2 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }
    
    .songs-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .song-card {
        padding: 0.75rem;
        border-radius: 8px;
    }
    
    .song-card h3 {
        font-size: 1.1rem;
    }
    
    .song-card p {
        font-size: 0.85rem;
    }
    
    .top-controls {
        margin-bottom: 0.4rem;
        padding: 0.3rem;
        border-radius: 4px;
        height: 34px;
    }
    
    .back-btn {
        left: 0.3rem;
        padding: 0.3rem;
        font-size: 0.8rem;
        width: 28px;
        height: 28px;
    }
    
    .song-info {
        padding: 0.02rem 0.5rem;
        gap: 0.6rem;
    }
    
    .song-title {
        font-size: 0.75rem;
        max-width: 200px;
    }
    
    .song-key-info {
        right: 0.3rem;
        font-size: 0.6rem;
        padding: 0.15rem 0.3rem;
    }
    
    .scroll-controls {
        margin-top: 0.5rem;
        margin-bottom: 0.4rem;
        padding: 0.3rem;
        gap: 0.4rem;
    }
    
    .back-btn {
        left: 0.3rem;
        padding: 0.3rem;
        font-size: 0.8rem;
        width: 28px;
        height: 28px;
    }
    
    .speed-btn, .play-btn {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    
    .speed-display {
        font-size: 0.7rem;
        right: 4.5rem;
    }
    
    .chord-toggle-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.65rem;
        height: 28px;
        right: 0.3rem;
    }
    
    .song-content {
        padding: 0.6rem;
        font-size: 0.8rem;
        line-height: 1.25;
        height: calc(100vh - 140px);
        border-radius: 6px;
    }
}

/* iOS Safari 特殊适配 - 为底部地址栏预留空间 */
@supports (-webkit-touch-callout: none) {
    /* 检测iOS设备 */
    .song-content {
        height: calc(100vh - 220px) !important;
        padding-bottom: 1.5rem;
    }
    
    @media (max-width: 768px) {
        .song-content {
            height: calc(100vh - 180px) !important;
            padding-bottom: 2rem;
        }
    }
}

/* 使用CSS环境变量适配iOS安全区域 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .song-display {
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    }
    
    .song-content {
        height: calc(100vh - 180px - env(safe-area-inset-bottom));
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }
    
    @media (max-width: 768px) {
        .song-content {
            height: calc(100vh - 140px - env(safe-area-inset-bottom));
            padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
        }
    }
}