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

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f0f5fb, #c0d3ee);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

/* 登录弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    min-width: 350px;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    text-align: center;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.modal-content input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* 头部 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.header h1 {
    font-size: 1.8rem;
    color: #2c3e50;
}

.header-actions {
    display: flex;
    gap: 10px;
}

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

.stat-card {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
}

/* 标签页 */
.tabs {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 25px;
}

.tab {
    padding: 12px 24px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    font-weight: 500;
    color: #7f8c8d;
}

.tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.tab:hover:not(.active) {
    color: #2c3e50;
    border-bottom-color: #bdc3c7;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 密钥添加区域 */
.key-add-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.add-single h3,
.add-bulk h3 {
    font-size: 1rem;
    color: #2c3e50;
    margin-bottom: 15px;
}

.input-group {
    display: flex;
    gap: 10px;
}

.key-input,
.key-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: monospace;
}

.key-input:focus,
.key-textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.key-textarea {
    resize: vertical;
    min-height: 100px;
}

/* 按钮样式 */
.primary-btn,
.action-btn,
.danger-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.primary-btn {
    background: #3498db;
    color: white;
}

.primary-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.action-btn {
    background: #95a5a6;
    color: white;
}

.action-btn:hover {
    background: #7f8c8d;
}

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

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

.danger-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.full-width {
    width: 100%;
    justify-content: center;
}

/* 批量操作栏 */
.bulk-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.select-all-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.select-all-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.select-all-wrapper label {
    cursor: pointer;
    font-weight: 500;
}

.selected-count {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* 密钥列表 */
.keys-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 15px;
}

.key-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.2s;
}

.key-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.key-card.selected {
    border-color: #3498db;
    background: #f0f8ff;
}

.key-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.key-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.key-id {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.key-balance {
    font-size: 1.1rem;
    font-weight: bold;
    color: #27ae60;
}

.key-value {
    font-family: monospace;
    font-size: 0.85rem;
    color: #34495e;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 4px;
    word-break: break-all;
    cursor: pointer;
    margin-bottom: 10px;
}

.key-value:hover {
    background: #e9ecef;
}

.key-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.8rem;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.disabled {
    background: #f8d7da;
    color: #721c24;
}

.last-check {
    color: #7f8c8d;
    font-size: 0.8rem;
}

.key-error {
    color: #e74c3c;
    font-size: 0.8rem;
    margin-top: 5px;
}

.key-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.key-actions button {
    flex: 1;
    padding: 6px 12px;
    font-size: 0.85rem;
    min-width: 70px;
}

/* 配置区域 */
.config-section {
    max-width: 600px;
}

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

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

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #7f8c8d;
    font-size: 0.85rem;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .key-add-section {
        grid-template-columns: 1fr;
    }

    .keys-container {
        grid-template-columns: 1fr;
    }

    .bulk-actions-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .stats-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .key-actions {
        flex-direction: column;
    }

    .key-actions button {
        width: 100%;
    }
}
