/* 嘀鸟 V2 - 全新 UI 样式 */
/* 2026-03-18 更新 */

:root {
    --primary: #1e3a5f;
    --secondary: #2d5a87;
    --accent: #ff9800;
    --success: #4caf50;
    --border: #e0e0e0;
    --text-primary: #333;
    --text-secondary: #666;
    --bg-card: #fff;
    --bg-page: #f5f5f5;
}

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

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

.app { max-width: 480px; min-height: 100vh; margin: 0 auto; background: var(--bg-page); }

/* ===== 头部 ===== */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #fff;
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-inner { display: flex; align-items: center; justify-content: space-between; }

.logo { display: flex; align-items: center; gap: 12px; }
.logo-image { width: 40px; height: 40px; object-fit: contain; }
.logo-text { font-size: 20px; font-weight: 600; }

/* ===== 智能控制面板 ===== */
.control-panel {
    background: #fff;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.control-row { display: flex; gap: 8px; align-items: center; }

.city-toggle, .date-toggle, .filter-toggle {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
}

.city-toggle, .date-toggle { flex: 1; justify-content: space-between; }
.filter-toggle { flex-shrink: 0; }

.city-icon, .date-icon, .filter-icon { font-size: 18px; }
.city-name { font-weight: 500; font-size: 15px; }
.toggle-arrow { color: var(--text-secondary); transition: transform 0.2s; }

.city-toggle.active .toggle-arrow { transform: rotate(180deg); }

.city-toggle:active, .date-toggle:active { background: #e0e0e0; }

/* ===== 下拉面板 ===== */
.panel-dropdown {
    display: none;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-top: 8px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-dropdown.show { display: block; }

.city-list button, .date-list button {
    width: 100%;
    padding: 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    color: var(--text-primary);
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.city-list button:last-child, .date-list button:last-child { border-bottom: none; }
.city-list button:active, .date-list button:active { background: #f0f0f0; }

.city-list button.active, .date-list button.active {
    background: #e3f2fd;
    color: var(--primary);
    font-weight: 500;
}

.city-comings {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    background: #fafafa;
    text-align: center;
}

/* ===== 日期导航条 ===== */
.date-nav-bar {
    display: flex;
    align-items: center;
    background: #fff;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.date-nav-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    margin: 0 4px;
    -webkit-tap-highlight-color: transparent;
}

.date-nav-btn:active { background: var(--bg-page); }

.date-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    flex: 1;
    padding: 0 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.date-strip::-webkit-scrollbar { display: none; }

.date-item {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    min-width: 56px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.date-item.active {
    background: var(--primary);
    color: #fff;
}

.date-month { font-size: 11px; opacity: 0.7; }
.date-day { font-size: 16px; font-weight: 600; margin-top: 2px; }

/* ===== 筛选面板 ===== */
.panel-filter {
    display: none;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-top: 8px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    animation: slideDown 0.2s ease-out;
}

.panel-filter.show { display: block; }

.filter-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
    -webkit-overflow-scrolling: touch;
}

.filter-tab {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--bg-page);
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
}

.filter-tab:active { background: #e0e0e0; }
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.sort-options select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: var(--text-primary);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* ===== 筛选提示条 ===== */
.filter-bar {
    display: none;
    align-items: center;
    gap: 8px;
    background: #fff3e0;
    padding: 10px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.filter-bar.show { display: flex; }

.active-tag {
    background: var(--accent);
    color: #fff;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
}

.clear-filter {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 12px;
}

.clear-filter:active { background: #ffe0b2; }

/* ===== 主内容区 ===== */
.content-section { padding: 20px 16px; }

.section-title { font-size: 20px; font-weight: 600; margin-bottom: 8px; }

.section-meta {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* ===== 高光列表 ===== */
.highlight-list { display: flex; flex-direction: column; gap: 12px; }

.highlight-item {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.highlight-item:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.rank {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.rank-gold { background: linear-gradient(135deg, #ffd700, #ffb300); color: #333; }
.rank-silver { background: linear-gradient(135deg, #c0c0c0, #9e9e9e); color: #fff; }
.rank-bronze { background: linear-gradient(135deg, #cd7f32, #a05a2c); color: #fff; }
.rank-normal { background: var(--bg-page); color: var(--text-secondary); border: 1px solid var(--border); font-size: 13px; }

.bird-info { flex: 1; min-width: 0; }

.bird-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; color: var(--text-primary); }
.latin { font-size: 12px; color: var(--text-secondary); font-style: italic; }

.bird-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.tag {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.tag-cr { background: #ffebee; color: #c62828; }
.tag-en { background: #fff3e0; color: #ef6c00; }
.tag-vu { background: #fff8e1; color: #f9a825; }
.tag-nt { background: #e8f5e9; color: #2e7d32; }
.tag-lc { background: #e3f2fd; color: #1976d2; }
.tag-p1 { background: #fce4ec; color: #c2185b; }
.tag-p2 { background: #f3e5f5; color: #7b1fa2; }

.reason { font-size: 13px; color: var(--text-secondary); margin-top: 6px; line-height: 1.4; }

.history-count { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.history-meta {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 8px;
    line-height: 1.3;
}

.history-main { background: var(--bg-page); color: var(--text-secondary); }
.today-record { background: #e8f5e9; color: #2e7d32; font-weight: 500; }

.rarity-badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 500;
}

.rarity-new { background: linear-gradient(135deg, gold, #ffb300); color: #333; }
.rarity-rare { background: linear-gradient(135deg, #ff5722, #f4511e); color: #fff; }
.rarity-uncommon { background: linear-gradient(135deg, #2196f3, #1976d2); color: #fff; }
.rarity-common { background: linear-gradient(135deg, #4caf50, #388e3c); color: #fff; }

/* ===== 加载和错误状态 ===== */
.loading, .error-state { text-align: center; padding: 60px 20px; }

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.error-icon { font-size: 56px; margin-bottom: 12px; display: block; }
.error-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.error-message { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

/* ===== 底部 ===== */
.footer {
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 24px 16px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.footer a { color: var(--primary); text-decoration: none; }

/* ===== 响应式适配 ===== */
@media (min-width: 481px) {
    .app { max-width: 600px; }
    .highlight-item { padding: 20px; }
    .section-title { font-size: 22px; }
}

/* ===== 深色模式支持 ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-page: #121212;
        --bg-card: #1e1e1e;
        --text-primary: #e0e0e0;
        --text-secondary: #a0a0a0;
        --border: #333;
    }
    
    .header { background: linear-gradient(135deg, #2a5298 0%, #1e3a5f 100%); }
    
    .city-toggle, .date-toggle, .filter-toggle { background: #2a2a2a; }
    
    .panel-dropdown, .panel-filter { background: #1e1e1e; }
}
