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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a1a;
    color: #e2e8f0;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
    background: #2d3748;
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

header h1 {
    font-size: 2.5rem;
    color: #f7fafc;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    color: #a0aec0;
    font-size: 1.1rem;
}

/* 控制面板样式 */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2d3748;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.provider-selection {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.provider-selection label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 8px 12px;
    border-radius: 8px;
}

.provider-selection label:hover {
    background: #4a5568;
}

.provider-selection input[type="checkbox"] {
    margin-right: 8px;
    scale: 1.2;
}

/* 云服务商颜色 */
.provider-selection label[data-provider="linode"] {
    color: #3498db;
}
.provider-selection label[data-provider="digitalocean"] {
    color: #ff69b4;
}
.provider-selection label[data-provider="aliyun"] {
    color: #ff8c00;
}
.provider-selection label[data-provider="tencent"] {
    color: #2ecc71;
}

/* 刷新按钮 */
#refresh-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 14px;
}

#refresh-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

#refresh-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

/* 地图容器样式 */
.map-container {
    background: #2d3748;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
    overflow: hidden;
    margin-bottom: 30px;
    min-height: 600px;
    position: relative;
}

#world-map {
    width: 100%;
    height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a202c;
    color: #a0aec0;
    font-size: 18px;
}

/* 数据展示区域 */
.data-container {
    background: #2d3748;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
    padding: 30px;
}

.data-container h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #f7fafc;
}

/* 区域网格布局 */
.regions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.provider-column {
    background: #1a202c;
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid #4a5568;
}

.provider-column h4 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #f7fafc;
}

.provider-badge {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.continent-section {
    margin-bottom: 20px;
}

.continent-section h5 {
    font-size: 1rem;
    color: #e2e8f0;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #4a5568;
}

.region-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.region-item {
    padding: 8px 12px;
    background: #2d3748;
    border-radius: 6px;
    font-size: 0.9rem;
    border: 1px solid #4a5568;
    transition: all 0.2s ease;
}

.region-item:hover {
    border-color: #718096;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    background: #374151;
}

.region-code {
    font-family: 'SF Mono', Monaco, monospace;
    color: #81e6d9;
    font-weight: 600;
}

.region-name {
    color: #a0aec0;
    margin-left: 10px;
}

/* 底部信息 */
.last-updated {
    text-align: center;
    padding: 20px;
    color: #a0aec0;
    font-size: 0.9rem;
    border-top: 1px solid #4a5568;
}

/* 加载状态 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #64748b;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .provider-selection {
        justify-content: center;
    }
    
    .regions-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* 统计卡片 */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 18px;
}

.stat-card {
    background: #2d3748;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #f7fafc;
    display: block;
}

.stat-label {
    color: #a0aec0;
    font-size: 0.9rem;
    margin-top: 5px;
}

/* 消息提示 */
.message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.message.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* 地图控制按钮样式 */
.map-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    pointer-events: none; /* 让父容器不阻挡点击 */
}

.control-btn {
    pointer-events: all; /* 恢复按钮的点击能力 */
    background: rgba(45, 55, 72, 0.9);
    color: #f7fafc;
    border: 2px solid #4a5568;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.control-btn:hover {
    background: rgba(66, 153, 225, 0.9);
    border-color: #3182ce;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* 缩放控制 - 左上角 */
.zoom-controls {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.zoom-btn {
    font-size: 20px;
    line-height: 1;
}

/* 方向控制 - 右上角 */
.direction-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 6px;
    width: 126px; /* 3 * 40px + 2 * 6px gap */
    height: 86px;  /* 2 * 40px + 1 * 6px gap */
}

#move-up {
    grid-column: 2;
    grid-row: 1;
}

#move-left {
    grid-column: 1;
    grid-row: 2;
}

#move-right {
    grid-column: 3;
    grid-row: 2;
}

#move-down {
    grid-column: 2;
    grid-row: 2;
}

.direction-btn {
    font-size: 16px;
    line-height: 1;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .zoom-controls {
        top: 10px;
        left: 10px;
    }
    
    .direction-controls {
        top: 10px;
        right: 10px;
        gap: 4px;
        width: 122px;
        height: 84px;
    }
    
    .control-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
}

/* 面包屑导航样式 */
.breadcrumb-nav {
    margin-bottom: 1rem;
}

.breadcrumb {
    background: #2d3748;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.breadcrumb-item {
    color: #a0aec0;
}

.breadcrumb-item a {
    color: #60a5fa;
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #f7fafc;
    font-weight: 500;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: #4a5568;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

/* 响应式面包屑 */
@media (max-width: 768px) {
    .breadcrumb {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .breadcrumb-nav {
        margin-bottom: 0.75rem;
    }
}

@media (max-width: 576px) {
    .breadcrumb {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
    
    .breadcrumb-item + .breadcrumb-item::before {
        padding-right: 0.3rem;
        padding-left: 0.3rem;
    }
}

/* Hero内容区域样式 */
.hero-content {
    text-align: center;
    padding: 2rem 0;
    background: #2d3748;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.hero-content h2 {
    color: #f7fafc;
    margin-bottom: 1rem;
    font-weight: 600;
}

.hero-content .lead {
    color: #a0aec0;
    font-size: 1.1rem;
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.6;
}

/* 特性介绍样式 */
.features-section {
    margin-bottom: 2rem;
}

.features-section .feature-card {
    background: #2d3748;
    border-radius: 8px;
    border: 1px solid #4a5568;
    height: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.features-section .feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    border-color: #60a5fa;
}

.feature-icon {
    font-size: 2rem;
    line-height: 1;
}

.features-section .feature-card h3 {
    color: #f7fafc;
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.features-section .feature-card p {
    color: #a0aec0;
    margin: 0;
    line-height: 1.5;
}

/* 响应式布局 */
@media (max-width: 768px) {
    .hero-content {
        padding: 1.5rem 1rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-content h2 {
        font-size: 1.5rem;
    }
    
    .hero-content .lead {
        font-size: 1rem;
    }
    
    .features-section .col-md-3 {
        margin-bottom: 1rem;
    }
    
    .feature-icon {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .hero-content {
        padding: 1rem;
    }
    
    .hero-content h2 {
        font-size: 1.3rem;
        margin-bottom: 0.8rem;
    }
    
    .features-section .feature-card {
        padding: 1rem !important;
    }
}

/* FAQ部分样式 */
.faq-section {
    background: #2d3748;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.faq-section h2 {
    color: #f7fafc;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.faq-section .accordion-item {
    background: #1a202c;
    border: 1px solid #4a5568;
    margin-bottom: 0.5rem;
    border-radius: 8px !important;
    overflow: hidden;
}

.faq-section .accordion-button {
    background: #1a202c;
    color: #f7fafc;
    border: none;
    font-weight: 500;
    padding: 1rem 1.25rem;
    box-shadow: none;
}

.faq-section .accordion-button:not(.collapsed) {
    background: #2d3748;
    color: #60a5fa;
    box-shadow: none;
}

.faq-section .accordion-button:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 0.25rem rgba(96, 165, 250, 0.25);
}

.faq-section .accordion-button::after {
    filter: brightness(0) invert(1);
}

.faq-section .accordion-button:not(.collapsed)::after {
    filter: brightness(0) invert(1) sepia(1) saturate(3) hue-rotate(195deg);
}

.faq-section .accordion-body {
    background: #2d3748;
    color: #cbd5e0;
    border-top: 1px solid #4a5568;
    padding: 1.25rem;
    line-height: 1.6;
}

.faq-section .accordion-body strong {
    color: #f7fafc;
}

.faq-section .accordion-body code {
    background: #1a202c;
    color: #60a5fa;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.875rem;
    border: 1px solid #4a5568;
}

/* FAQ响应式样式 */
@media (max-width: 768px) {
    .faq-section {
        padding: 1.5rem 1rem;
        margin-top: 2rem !important;
    }
    
    .faq-section h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .faq-section .accordion-button {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }
    
    .faq-section .accordion-body {
        padding: 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .faq-section {
        border-radius: 8px;
        padding: 1rem 0.75rem;
    }
    
    .faq-section .accordion-button {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .faq-section .accordion-body {
        padding: 0.875rem;
    }
}

/* 移动端优化增强 */
@media (hover: none) and (pointer: coarse) {
    /* 触摸设备优化 */
    .control-btn {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .feature-card:hover {
        transform: none; /* 禁用触摸设备的hover效果 */
    }
    
    .accordion-button {
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(96, 165, 250, 0.2);
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .map-container {
        transform: translateZ(0); /* 硬件加速 */
    }
}

/* 横屏模式优化 */
@media (max-width: 896px) and (orientation: landscape) {
    .hero-content {
        padding: 1rem 0;
    }
    
    .hero-content h2 {
        font-size: 1.3rem;
    }
    
    .features-section {
        margin-bottom: 1rem;
    }
    
    .faq-section {
        margin-top: 1.5rem !important;
    }
}

/* 超小屏幕设备 */
@media (max-width: 320px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .breadcrumb {
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .feature-card {
        padding: 0.75rem !important;
    }
    
    .stat-card {
        padding: 0.75rem !important;
    }
}

/* 减少动画和过渡效果 (省电模式) */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .feature-card:hover {
        transform: none;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: light) {
    /* 如果用户偏好浅色模式，保持当前暗色主题但微调对比度 */
    body {
        background: #1a1a1a;
        color: #e2e8f0;
    }
}
