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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #059669;
    --warning-color: #d97706;
    --error-color: #dc2626;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-content .title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-content .icon {
    font-size: 2.5rem;
}

.header-content .subtitle {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 400;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.update-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 0.875rem;
}

.update-label {
    opacity: 0.8;
}

.update-time {
    font-weight: 600;
    font-size: 1rem;
}

.refresh-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.refresh-btn:active {
    transform: translateY(0);
}

.refresh-icon {
    font-size: 1.1rem;
    transition: transform 0.5s ease;
}

.refresh-btn.loading .refresh-icon {
    animation: spin 1s linear infinite;
}

/* 调试按钮样式 */
.debug-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.2);
}

.debug-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.3);
}

.debug-btn:active {
    transform: translateY(0);
}

.debug-icon {
    font-size: 1rem;
}

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

/* 统计信息样式 */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 加载状态样式 */
.loading-section {
    text-align: center;
    padding: 4rem 2rem;
}

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

.loading-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* 错误状态样式 */
.error-section {
    text-align: center;
    padding: 4rem 2rem;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--error-color);
    margin-bottom: 0.5rem;
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.retry-btn {
    background: var(--error-color);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.retry-btn:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

.diagnostic-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.2);
}

.diagnostic-btn:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.3);
}

/* 货币筛选样式 */
.currency-filter {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.currency-filter label {
    font-weight: 500;
    color: var(--text-primary);
}

.currency-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.currency-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 银行网格样式 */
.banks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.bank-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    overflow: hidden;
}

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

.bank-card.error {
    border-color: var(--error-color);
    background: #fef2f2;
}

.bank-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.bank-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.bank-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
}

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

.bank-body {
    padding: 1.5rem;
}

.error-message-card {
    color: var(--error-color);
    font-size: 0.875rem;
    padding: 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    margin: 1rem;
}

.rates-table {
    width: 100%;
    border-collapse: collapse;
}

.rates-table th,
.rates-table td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.rates-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rates-table td {
    color: var(--text-primary);
}

.currency-name {
    font-weight: 500;
}

.rate-value {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-weight: 600;
}

.rate-value.buy {
    color: var(--success-color);
}

.rate-value.sell {
    color: var(--error-color);
}

/* 页脚样式 */
.footer {
    margin-top: auto;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }
    
    .header {
        padding: 1.5rem;
        flex-direction: column;
        text-align: center;
    }
    
    .header-content .title {
        font-size: 1.5rem;
    }
    
    .header-info {
        width: 100%;
        justify-content: center;
    }
    
    .stats-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .banks-grid {
        grid-template-columns: 1fr;
    }
    
    .currency-filter {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .rates-table {
        font-size: 0.75rem;
    }
    
    .rates-table th,
    .rates-table td {
        padding: 0.5rem 0.25rem;
    }
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* API诊断界面样式 */
.detailed-error-state {
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.detailed-error-state h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.detailed-error-state h4 {
    color: var(--text-primary);
    margin: 1.5rem 0 1rem 0;
    font-size: 1.1rem;
}

.diagnostic-info {
    background: #f8fafc;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-color);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
}

.diagnostic-results {
    margin-bottom: 2rem;
}

.test-result {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    padding: 1rem;
    transition: all 0.2s ease;
}

.test-result:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.test-result.success {
    border-left: 4px solid var(--success-color);
    background: #f0fdf4;
}

.test-result.failed {
    border-left: 4px solid var(--error-color);
    background: #fef2f2;
}

.test-result.info {
    border-left: 4px solid #3b82f6;
    background: #eff6ff;
}

.test-result.warning {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
}

.test-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.test-message {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    word-break: break-all;
}

.test-details {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

.error-analysis {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.analysis-content {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.solution-list {
    margin: 0;
    padding-left: 1.5rem;
}

.solution-list li {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.api-config-guide {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.config-content {
    color: var(--text-primary);
    line-height: 1.6;
}

.config-content p {
    margin-bottom: 1rem;
}

.config-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
}

.config-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.config-content li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.config-content a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.config-content a:hover {
    text-decoration: underline;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .detailed-error-state {
        padding: 1.5rem;
        margin: 0.5rem;
    }
    
    .test-result {
        padding: 0.75rem;
    }
    
    .diagnostic-info {
        padding: 0.75rem;
        font-size: 0.8rem;
    }
    
    .test-message {
        font-size: 0.75rem;
        padding: 0.4rem;
    }
    
    .error-analysis,
    .api-config-guide {
        padding: 1rem;
    }
} 