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

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* 自定义样式 */
:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --background: #f9fafb;
    --surface: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --background: #111827;
        --surface: #1f2937;
        --border: #374151;
    }
}

/* 字体设置 */
body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
}

/* 滚动条样式 */
.scrollbar-thin::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
    transition: background 0.3s ease;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* 火狐浏览器滚动条 */
.scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f1f1f1;
}

/* 城市容器动画 */
.cities-container {
    transition: max-height 0.3s ease-in-out;
    max-height: 800px;
    overflow: hidden;
}

.cities-container.collapsed {
    max-height: 200px;
}

/* 淡入动画 */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 复制反馈效果 */
.copy-feedback {
    transition: all 0.3s ease;
    border-radius: 6px;
    position: relative;
}

.copy-feedback:hover {
    background-color: rgba(59, 130, 246, 0.05);
    transform: translateX(2px);
}

.copy-feedback:active {
    transform: translateX(0) scale(0.98);
}

/* 波纹效果 */
.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 600ms linear;
    background-color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* 按钮增强样式 */
button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

button:active {
    transform: translateY(0);
}

button:focus {
    outline: none;
    ring: 2px;
    ring-color: var(--primary-color);
    ring-opacity: 0.5;
}

/* 卡片悬停效果 */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* 加载动画 */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast 通知样式增强 */
#toast, #language-toast {
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 语言切换下拉菜单 */
#language-menu {
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    animation: fadeInDown 0.3s ease;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

/* 导航栏增强 */
nav {
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.8);
    transition: all 0.3s ease;
}

.nav-link-hover {
    position: relative;
    overflow: hidden;
}

.nav-link-hover::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.nav-link-hover:hover::before {
    transform: translateX(0);
}

/* 移动端优化 */
@media (max-width: 768px) {
    .fade-in {
        transform: translateY(10px);
    }
    
    .card-hover:hover {
        transform: none;
    }
    
    button:hover {
        transform: none;
    }
    
    .copy-feedback:hover {
        transform: none;
        background-color: rgba(59, 130, 246, 0.1);
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    :root {
        --border: #000000;
        --text-secondary: #000000;
    }
    
    .copy-feedback:hover {
        background-color: rgba(0, 0, 0, 0.1);
        border: 1px solid #000000;
    }
}

/* 减少动画偏好支持 */
@media (prefers-reduced-motion: reduce) {
    .fade-in,
    .copy-feedback,
    button,
    .card-hover,
    .cities-container {
        transition: none;
        animation: none;
    }
    
    .ripple {
        display: none;
    }
}

/* 打印样式 */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .bg-gradient-to-r {
        background: #1f2937 !important;
        color: white !important;
    }
    
    .shadow-md,
    .shadow-lg {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}

/* 可访问性增强 */
.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;
}

/* Focus visible 支持 */
.focus-visible:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 自定义选择样式 */
::selection {
    background-color: var(--primary-color);
    color: white;
}

::-moz-selection {
    background-color: var(--primary-color);
    color: white;
}

/* 表单控件增强 */
select:focus,
input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Select下拉框样式 */
select {
    color: var(--text-primary) !important;
    background-color: var(--surface);
}

select option {
    color: var(--text-primary) !important;
    background-color: var(--surface);
}

/* 强化侧边栏select样式 */
.sidebar select,
div[class*="sidebar"] select,
[class*="filter"] select {
    color: #1f2937 !important;
}

.sidebar select option,
div[class*="sidebar"] select option,
[class*="filter"] select option {
    color: #1f2937 !important;
    background-color: #ffffff !important;
}

/* 地图容器优化 */
.map-container iframe {
    transition: opacity 0.3s ease;
}

.map-container.loading iframe {
    opacity: 0.5;
}

/* 错误状态样式 */
.error-state {
    border-color: var(--error-color);
    background-color: rgba(239, 68, 68, 0.05);
}

/* 成功状态样式 */
.success-state {
    border-color: var(--success-color);
    background-color: rgba(16, 185, 129, 0.05);
}

/* 工具提示样式 */
.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.tooltip:hover::before {
    opacity: 1;
}

/* 响应式图片 */
img {
    max-width: 100%;
    height: auto;
}

/* 链接样式 */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* 代码块样式 */
code {
    background-color: #f3f4f6;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 0.9em;
}

pre {
    background-color: #f3f4f6;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    line-height: 1.4;
}

pre code {
    background: none;
    padding: 0;
}

/* 表格样式 */
table {
    border-collapse: collapse;
    width: 100%;
}

th, td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    background-color: rgba(59, 130, 246, 0.05);
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 32px 0;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-primary);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.pagination button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 骨架屏加载效果 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

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

.empty-state i {
    font-size: 4rem;
    color: var(--secondary-color);
    margin-bottom: 16px;
}

/* 徽章样式 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge.success {
    background: var(--success-color);
}

.badge.warning {
    background: var(--warning-color);
}

.badge.error {
    background: var(--error-color);
}

/* 进度条样式 */
.progress {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 面包屑导航 */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.breadcrumb a {
    color: var(--primary-color);
}

.breadcrumb .separator {
    color: var(--text-secondary);
}

/* 标签样式 */
.tag {
    display: inline-block;
    padding: 4px 12px;
    background: #f3f4f6;
    color: var(--text-primary);
    border-radius: 16px;
    font-size: 0.75rem;
    margin: 2px;
    transition: all 0.3s ease;
}

.tag:hover {
    background: #e5e7eb;
}

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

/* 语言下拉菜单增强 */
#language-chevron {
    transition: transform 0.2s ease;
}

.rotate-180 {
    transform: rotate(180deg);
}

/* Header增强样式 */
.header-bg-animation {
    background: linear-gradient(-45deg, #3b82f6, #1e40af, #1d4ed8, #2563eb);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 统计卡片动画 */
.stats-card {
    transition: all 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

/* 按钮增强 */
.btn-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-primary::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 ease;
}

.btn-primary:hover::before {
    left: 100%;
}

/* Footer增强样式 */
footer {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

.footer-link {
    position: relative;
    transition: all 0.3s ease;
}

.footer-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    transition: width 0.3s ease;
}

.footer-link:hover::after {
    width: 100%;
}

/* 社交图标动画 */
.social-icon {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.social-icon:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

/* 回到顶部按钮增强 */
#back-to-top {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#back-to-top:hover {
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4);
}

/* 加载状态 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

/* 响应式增强 */
@media (max-width: 768px) {
    .header-bg-animation {
        background-size: 200% 200%;
    }
    
    .stats-card:hover {
        transform: none;
    }
    
    .social-icon:hover {
        transform: scale(1.05);
    }
    
    #back-to-top {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
}

/* 深色主题适配 */
@media (prefers-color-scheme: dark) {
    nav {
        background: rgba(17, 24, 39, 0.95);
        border-bottom-color: rgba(75, 85, 99, 0.5);
    }
    
    #language-menu {
        background: rgb(17, 24, 39);
        border-color: rgb(75, 85, 99);
    }
}

/* 高对比度支持 */
@media (prefers-contrast: high) {
    nav {
        background: rgba(255, 255, 255, 1);
        border-bottom: 2px solid #000;
    }
    
    .btn-primary {
        border: 2px solid #000;
    }
    
    footer {
        background: #000;
        color: #fff;
    }
}

/* 打印样式 */
@media print {
    nav,
    footer,
    #back-to-top {
        display: none !important;
    }
    
    header {
        background: none !important;
        color: #000 !important;
    }
}

/* 可访问性增强 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus状态增强 */
*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 4px;
}

/* 工具提示增强 */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(17, 24, 39, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    z-index: 1000;
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.2s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 新增文本渐变效果 */
.text-gradient {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 毛玻璃效果 */
.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

/* 新增网格背景效果 */
.grid-bg {
    background-image: 
        linear-gradient(rgba(59, 130, 246, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
}