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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

/* 头部样式 */
.header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

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

.header h1 {
    color: #2d3748;
    font-size: 2rem;
    font-weight: 700;
}

.header h1 i {
    color: #667eea;
    margin-right: 12px;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

#last-update {
    color: #666;
    font-size: 0.9rem;
}

.refresh-indicator {
    display: none;
    color: #667eea;
    font-size: 0.9rem;
    margin: 0 12px;
    opacity: 0.8;
}

.refresh-indicator i {
    margin-right: 4px;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
    transform: translateY(-2px);
}

.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
}

/* 仪表板统计 */
.dashboard {
    margin-bottom: 32px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.stat-icon.healthy {
    background: #48bb78;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
    line-height: 1;
}

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

/* 提供商部分 */
.providers-section, .system-section, .test-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.providers-section h2, .system-section h2, .test-section h2 {
    color: #2d3748;
    margin-bottom: 24px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 提供商网格布局 */
.providers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

/* 大屏幕优化 */
@media (min-width: 1400px) {
    .providers-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 中等屏幕 */
@media (max-width: 1200px) and (min-width: 769px) {
    .providers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.provider-card {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    min-height: 220px;
    display: flex;
    flex-direction: column;
}

.provider-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.provider-card.healthy {
    border-color: #48bb78;
    background: linear-gradient(135deg, #f0fff4 0%, #c6f6d5 100%);
}

.provider-card.unhealthy {
    border-color: #f56565;
    background: linear-gradient(135deg, #fed7d7 0%, #feb2b2 100%);
}

.provider-card.unknown {
    border-color: #ed8936;
    background: linear-gradient(135deg, #fefcbf 0%, #faf089 100%);
}

.provider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.provider-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2d3748;
    text-transform: capitalize;
    display: flex;
    align-items: center;
    gap: 8px;
}

.usage-indicator {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: 500;
    text-transform: none;
}

.usage-indicator.high {
    background: #fed7d7;
    color: #c53030;
}

.usage-indicator.active {
    background: #c6f6d5;
    color: #2f855a;
}

.provider-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-healthy {
    background: #48bb78;
    color: white;
}

.status-unhealthy {
    background: #f56565;
    color: white;
}

.status-unknown {
    background: #ed8936;
    color: white;
}

.provider-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
    flex-grow: 1;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 0.9rem;
}

.summary-item i {
    color: #667eea;
    width: 16px;
    text-align: center;
}

.summary-item span {
    color: #2d3748;
    font-weight: 500;
}

.provider-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* 系统状态 */
.system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.system-card {
    background: #f8fafc;
    border-radius: 8px;
    padding: 20px;
}

.system-card h3 {
    color: #2d3748;
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.metrics {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

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

.metric-label {
    color: #666;
}

.metric-value {
    font-weight: 600;
    color: #2d3748;
}

/* 测试工具 */
.test-panel {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 24px;
    align-items: start;
}

.test-form {
    background: #f8fafc;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    min-width: 350px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2d3748;
}

.form-group label i {
    margin-right: 6px;
    color: #667eea;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    min-height: 44px;
}

.form-control[type="text"], 
.form-control select {
    height: 44px;
}

.form-control select {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23667eea' d='m2 0-2 2h4zm0 5 2-2h-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.form-control select:hover {
    border-color: #667eea;
    background-color: #f8fafc;
}

.form-control select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control textarea {
    min-height: 80px;
    resize: vertical;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

.test-result {
    background: #f8fafc;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    min-height: 200px;
    overflow: auto;
}

.test-result h4 {
    color: #2d3748;
    margin-bottom: 12px;
}

#test-output {
    background: #2d3748;
    color: #f8fafc;
    padding: 16px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    max-height: 300px;
    overflow-y: auto;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 24px;
    border-radius: 12px;
    width: 80%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

/* 加载指示器 */
.loading {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #2d3748;
    font-weight: 600;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .providers-grid {
        grid-template-columns: 1fr;
    }
    
    .test-panel {
        grid-template-columns: 1fr;
    }
    
    .test-form {
        min-width: auto;
    }
    
    .form-control select {
        background-size: 10px;
        padding-right: 35px;
    }
    
    .provider-info {
        grid-template-columns: 1fr;
    }
    
    .system-grid {
        grid-template-columns: 1fr;
    }
}

/* 状态指示器动画 */
.status-healthy {
    animation: healthyPulse 2s infinite;
}

@keyframes healthyPulse {
    0% { box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(72, 187, 120, 0); }
    100% { box-shadow: 0 0 0 0 rgba(72, 187, 120, 0); }
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #2d3748;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}