/* 热搜聚合 - 样式文件 */

/* ===== CSS变量 ===== */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #667eea;
    --accent-hover: #764ba2;
    --error: #f87171;
    --success: #34d399;
    --warning: #fbbf24;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-primary);
    transition: background var(--transition-normal), color var(--transition-normal);
    line-height: 1.6;
}

/* ===== 辅助类 ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== 头部 ===== */
header {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 2.5rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 0%, rgba(102, 126, 234, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ===== 主内容区 ===== */
main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ===== 区块通用样式 ===== */
section {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--glass-border);
    transition: all var(--transition-normal);
}

section:hover {
    border-color: rgba(102, 126, 234, 0.2);
}

section h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

section h2 .icon {
    font-size: 1.1em;
}

/* ===== 平台选择 ===== */
.platform-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.category-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.3rem 0.8rem;
    background: rgba(102, 126, 234, 0.15);
    border-radius: var(--radius-full);
    font-weight: 500;
    display: block;
    width: 100%;
    margin: 0.8rem 0 0.4rem;
    text-align: left;
    border-left: 3px solid var(--accent);
    padding-left: 0.6rem;
}

.platform-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.platform-btn {
    padding: 0.6rem 1rem;
    border: 1px solid rgba(102, 126, 234, 0.3);
    background: rgba(102, 126, 234, 0.08);
    color: var(--text-primary);
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.platform-emoji {
    font-size: 1.1rem;
    line-height: 1;
}

.platform-name {
    white-space: nowrap;
}

.platform-btn:hover {
    background: rgba(102, 126, 234, 0.25);
    border-color: rgba(102, 126, 234, 0.5);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.platform-btn:active {
    transform: scale(0.97);
}

.platform-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
    box-shadow: var(--shadow-md), 0 0 20px rgba(102, 126, 234, 0.3);
}

.platform-btn.active:hover {
    transform: translateY(-1px);
}

/* ===== 日期选择 ===== */
.date-controls {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
}

#date-picker {
    padding: 0.6rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    outline: none;
    transition: all var(--transition-fast);
    color-scheme: dark;
    flex: 0 0 auto;
    width: auto;
    min-width: 140px;
}

#date-picker::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

#date-picker:focus {
    border-color: var(--accent);
    background: rgba(102, 126, 234, 0.1);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.date-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: auto;
    white-space: nowrap;
}

#load-hotsearch {
    padding: 0.7rem 1.5rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
}

#load-hotsearch::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

#load-hotsearch:hover::before {
    left: 100%;
}

#load-hotsearch:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(102, 126, 234, 0.3);
}

#load-hotsearch:active {
    transform: translateY(0);
}

#load-hotsearch.loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-icon {
    transition: transform var(--transition-normal);
}

#load-hotsearch.loading .btn-icon {
    animation: spin 1s linear infinite;
}

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

/* ===== 热搜列表 ===== */
.hotsearch-list {
    min-height: 200px;
}

.placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 2rem;
    font-size: 1rem;
}

.hotsearch-item {
    display: flex;
    align-items: center;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: all var(--transition-fast);
    border-radius: var(--radius-sm);
    margin-bottom: 0.4rem;
}

.hotsearch-item:hover {
    background: rgba(102, 126, 234, 0.12);
    transform: translateX(4px);
}

.hotsearch-item:last-child {
    border-bottom: none;
}

.hotsearch-item a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    display: block;
    flex: 1;
    transition: color var(--transition-fast);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hotsearch-item a:hover {
    color: #f093fb;
}

.hotsearch-item .rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    background: var(--primary-gradient);
    color: white;
    border-radius: 50%;
    margin-right: 0.8rem;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.hotsearch-item .rank.top1 {
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
    font-size: 0.85rem;
}

.hotsearch-item .rank.top2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #a8a8a8 100%);
}

.hotsearch-item .rank.top3 {
    background: linear-gradient(135deg, #cd7f32 0%, #b87333 100%);
}

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

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 3px solid rgba(102, 126, 234, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===== 错误状态 ===== */
.error {
    text-align: center;
    padding: 2rem;
    color: var(--error);
    background: rgba(248, 113, 113, 0.08);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.error-icon {
    font-size: 2rem;
}

.retry-btn {
    padding: 0.5rem 1.2rem;
    background: rgba(102, 126, 234, 0.2);
    color: var(--text-primary);
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.retry-btn:hover {
    background: rgba(102, 126, 234, 0.3);
}

/* ===== 消息提示 ===== */
.message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    text-align: center;
}

.message-warning {
    background: rgba(251, 191, 36, 0.1);
    color: var(--warning);
}

.message-info {
    background: rgba(102, 126, 234, 0.1);
    color: var(--accent);
}

/* ===== 页脚 ===== */
footer {
    background: var(--glass-bg);
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid var(--glass-border);
    margin-top: 2rem;
}

footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

footer a:hover {
    color: #f093fb;
    text-decoration: underline;
}

.copyright {
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    main {
        padding: 1rem;
    }
    
    section {
        padding: 1.2rem;
    }
    
    .platform-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .date-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    #date-picker {
        min-width: 100%;
    }
    
    .date-hint {
        min-width: auto;
        font-size: 0.8rem;
    }
    
    #load-hotsearch {
        width: 100%;
        justify-content: center;
    }
    
    .hotsearch-item {
        padding: 0.7rem 0.8rem;
    }
    
    .hotsearch-item a {
        font-size: 0.9rem;
    }
    
    .hotsearch-item:hover {
        transform: none;
    }
}

/* ===== 触摸优化 ===== */
@media (hover: none) and (pointer: coarse) {
    .platform-btn {
        padding: 0.7rem 1.1rem;
    }
    
    .hotsearch-item {
        padding: 1rem 0.8rem;
    }
    
    .hotsearch-item a {
        padding: 0.3rem 0;
    }
    
    #load-hotsearch {
        padding: 0.9rem 1.5rem;
    }
}

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

section {
    animation: fadeIn 0.4s ease-out;
}

section:nth-child(2) {
    animation-delay: 0.1s;
}

section:nth-child(3) {
    animation-delay: 0.2s;
}

/* ===== 选中动画 ===== */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(102, 126, 234, 0);
    }
}

.platform-btn.active {
    animation: pulse 2s infinite;
}

/* ===== 高对比度模式 ===== */
@media (prefers-contrast: high) {
    .platform-btn {
        border-width: 2px;
    }
    
    .hotsearch-item {
        border-bottom-width: 2px;
    }
}

/* ===== 暗色主题 ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-gradient: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
    }
}
