/* 智谱API余额查询页面样式 */
/* 基于原TypeScript项目的样式设计 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 32px;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 16px;
    opacity: 0.9;
    font-weight: 300;
}

/* 输入区域样式 */
.input-section {
    padding: 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.input-header {
    margin-bottom: 20px;
}

.input-header h3 {
    font-size: 20px;
    color: #495057;
    margin-bottom: 8px;
    font-weight: 600;
}

.input-tips {
    font-size: 14px;
    color: #6c757d;
}

.textarea-container {
    position: relative;
    margin-bottom: 20px;
}

#apiKeysInput {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    resize: vertical;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#apiKeysInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.validation-results {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.validation-item {
    font-size: 14px;
    font-weight: 500;
}

.validation-item.valid {
    color: #28a745;
}

.validation-item.duplicate {
    color: #ffc107;
}

.validation-item.invalid {
    color: #dc3545;
}

/* 按钮组样式 */
.button-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.validate-btn, .query-btn, .clear-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.validate-btn {
    background: #28a745;
    color: white;
}

.validate-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.query-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.query-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.query-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.clear-btn {
    background: #6c757d;
    color: white;
}

.clear-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* 分页区域样式 */
.pagination-section {
    padding: 20px 30px;
    background: white;
    border-bottom: 1px solid #e9ecef;
}

.pagination-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-btn {
    padding: 8px 16px;
    border: 1px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.page-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
}

.page-btn:disabled {
    background: #f8f9fa;
    color: #6c757d;
    border-color: #e9ecef;
    cursor: not-allowed;
}

#pageSelect {
    padding: 8px 12px;
    border: 1px solid #667eea;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: #667eea;
    cursor: pointer;
}

/* 结果区域样式 */
.results-section {
    padding: 30px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.results-header h3 {
    font-size: 20px;
    color: #495057;
    font-weight: 600;
}

.update-time {
    font-size: 14px;
    color: #6c757d;
}

/* 统计卡片样式 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.stat-card .label {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-card .value {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

th.number {
    text-align: right;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
}

td.number {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

td.error-row {
    color: #dc3545;
    text-align: center;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

tbody tr:last-child td {
    border-bottom: none;
}

tfoot {
    background: #f8f9fa;
    font-weight: bold;
}

tfoot td {
    padding: 15px;
    border-top: 2px solid #667eea;
    border-bottom: none;
}

.key-cell {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #495057;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 加载遮罩样式 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    font-size: 16px;
    color: #495057;
    font-weight: 500;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 12px;
    }
    
    .header {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .input-section, .results-section {
        padding: 20px;
    }
    
    .stats-cards {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 15px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .pagination-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .stats-cards {
        grid-template-columns: 1fr 1fr;
    }
    
    .validation-results {
        flex-direction: column;
        gap: 10px;
    }
}