/* ========== 全局样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: #F8F9FA;
    color: #333333;
    line-height: 1.6;
}

/* ========== 顶部固定标题栏 ========== */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: #0A2F51;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 1000;
}

.main-header h1 {
    flex: 1;
    text-align: center;
    font-size: 22px;
    font-weight: 600;
}

/* ========== 语言切换按钮 ========== */
.lang-switch {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.lang-btn {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.lang-btn.active {
    background: white;
    color: #0A2F51;
    border-color: white;
    font-weight: 500;
}

/* ========== 主体容器 ========== */
.main-container {
    padding-top: 56px; /* 避免被固定标题遮挡 */
}

/* ========== 主导航（大类） ========== */
.main-nav {
    background-color: #FFFFFF;
    border-bottom: 1px solid #E9ECEF;
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch; /* 平滑滚动 */
    scrollbar-width: none; /* Firefox 隐藏滚动条 */
}

.main-nav::-webkit-scrollbar {
    display: none; /* Chrome/Safari 隐藏滚动条 */
}

.nav-btn {
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 500;
    color: #333333;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.nav-btn:hover {
    background-color: #F8F9FA;
}

.nav-btn.active {
    color: #0A2F51;
    border-bottom-color: #0A2F51;
}

/* ========== 二级导航（小类） ========== */
.sub-nav {
    background-color: #FFFFFF;
    border-bottom: 1px solid #E9ECEF;
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.sub-nav::-webkit-scrollbar {
    display: none;
}

.sub-nav-btn {
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 500;
    color: #333333;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.sub-nav-btn:hover {
    background-color: #F8F9FA;
}

.sub-nav-btn.active {
    color: #0A2F51;
    border-bottom-color: #0A2F51;
}

/* ========== 内容展示区 ========== */
.content-area {
    padding: 16px;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: #6C757D;
}

.welcome-message h2 {
    font-size: 24px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 12px;
}

.welcome-message p {
    font-size: 16px;
}

/* ========== 鸟类名片网格 ========== */
.birds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.bird-card {
    background: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bird-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.bird-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.card-content {
    padding: 12px;
}

.card-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333333;
    text-align: center;
}

/* ========== 详情弹窗 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    position: relative;
    background: #FFFFFF;
    border-radius: 12px;
    max-width: 90%;
    width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 32px;
    color: #6C757D;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    color: #333333;
}

.modal-body {
    padding: 24px;
    padding-top: 48px; /* 为关闭按钮留出空间 */
}

.modal-body h2 {
    font-size: 28px;
    font-weight: 600;
    color: #0A2F51;
    margin-bottom: 8px;
}

.scientific-name {
    font-size: 16px;
    color: #6C757D;
    font-style: italic;
    margin-bottom: 20px;
}

.modal-main-image {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 20px;
    display: block;
}

.modal-body h3 {
    font-size: 20px;
    font-weight: 600;
    color: #0A2F51;
    margin-top: 24px;
    margin-bottom: 12px;
}

.modal-body p {
    font-size: 16px;
    color: #333333;
    margin-bottom: 12px;
    line-height: 1.6;
}

.modal-body p strong {
    color: #0A2F51;
}

.bird-audio {
    width: 100%;
    margin-top: 16px;
}

/* ========== 音频播放按钮 ========== */
.audio-play-btn {
    background: linear-gradient(135deg, #0A2F51 0%, #1a4d7a 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(10, 47, 81, 0.3);
    flex-shrink: 0;
    position: relative;
    padding: 0;
}

.audio-play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(10, 47, 81, 0.4);
    background: linear-gradient(135deg, #0d3a63 0%, #1f5a94 100%);
}

.audio-play-btn:active {
    transform: scale(0.95);
}

.audio-play-btn svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.audio-play-btn .play-icon {
    margin-left: 2px; /* 微调播放图标位置，使其视觉居中 */
}

/* ========== 提示文本样式 ========== */
.loading-text, .error-text, .empty-message {
    text-align: center;
    padding: 40px 20px;
    font-size: 16px;
    color: #6C757D;
}

.error-text {
    color: #dc3545;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .main-header h1 {
        font-size: 18px;
    }
    
    .birds-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .modal-content {
        max-width: 95%;
        max-height: 90vh;
    }
    
    .modal-body {
        padding: 16px;
        padding-top: 40px;
    }
    
    .modal-body h2 {
        font-size: 24px;
    }
    
    .modal-close {
        font-size: 28px;
        top: 12px;
        right: 12px;
    }
}

@media (max-width: 480px) {
    .nav-btn, .sub-nav-btn {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .birds-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .card-content h3 {
        font-size: 16px;
    }
}
