/* Copyright (c) 2025 - Developer: TG @ddosadmin */
/* ==================== 全局变量 ==================== */
:root {
    /* 亮色主题 */
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #fafbfc;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    
    /* 品牌色 */
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #dbeafe;
    
    --color-success: #10b981;
    --color-success-light: #d1fae5;
    
    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    
    --color-danger: #ef4444;
    --color-danger-light: #fee2e2;
    
    --color-info: #6366f1;
    --color-info-light: #e0e7ff;
}

/* 暗色主题 */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #334155;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* ==================== 基础样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
                 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ==================== 顶部导航 ==================== */
.header {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px 30px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo i {
    color: var(--color-primary);
    font-size: 28px;
}

.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

/* ==================== 统计面板 ==================== */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon-primary {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.stat-icon-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.stat-icon-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.stat-icon-success {
    background: var(--color-success-light);
    color: var(--color-success);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==================== API使用情况 ==================== */
.api-usage {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.realtime-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--color-success-light);
    color: var(--color-success);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 2s ease-in-out infinite;
}

[data-theme="dark"] .realtime-badge {
    background: rgba(16, 185, 129, 0.15);
}

.realtime-badge i {
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2 i {
    color: var(--color-primary);
}

.usage-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.usage-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.usage-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.usage-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.usage-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-info));
    color: white;
}

.usage-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.usage-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.usage-limit {
    font-size: 12px;
    color: var(--text-tertiary);
}

.usage-stats {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}

.usage-number {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.usage-number .used {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.usage-number .separator {
    font-size: 18px;
    color: var(--text-tertiary);
    margin: 0 2px;
}

.usage-number .total {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
}

.usage-remaining {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-success);
    padding: 4px 10px;
    background: var(--color-success-light);
    border-radius: 6px;
}

.usage-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.usage-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-info));
    border-radius: 10px;
    transition: width 0.5s ease, background 0.3s ease;
    position: relative;
}

.usage-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ==================== 添加域名表单 ==================== */
.add-domains {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.add-form textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Consolas', 'Monaco', monospace;
    resize: vertical;
    transition: all 0.3s ease;
}

.add-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-export {
    background: var(--color-success);
    color: white;
}

.btn-export:hover {
    background: #059669;
    transform: translateY(-2px);
}

.form-hint {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--color-info-light);
    color: var(--color-info);
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

[data-theme="dark"] .form-hint {
    background: rgba(99, 102, 241, 0.15);
    color: var(--text-secondary);
}

/* ==================== 检测结果 ==================== */
.results {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.section-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.filter-group {
    display: flex;
    gap: 8px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: 8px;
}

.filter-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--color-primary);
    color: white;
}

.table-container {
    margin-top: 20px;
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table thead {
    background: var(--bg-tertiary);
}

.results-table th {
    padding: 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.results-table td {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-primary);
}

.results-table tbody tr {
    transition: background 0.2s ease;
}

.results-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.status-pending {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.status-processing {
    background: var(--color-info-light);
    color: var(--color-info);
}

.status-completed {
    background: var(--color-success-light);
    color: var(--color-success);
}

.status-failed {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

[data-theme="dark"] .status-pending {
    background: rgba(245, 158, 11, 0.15);
}

[data-theme="dark"] .status-processing {
    background: rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .status-completed {
    background: rgba(16, 185, 129, 0.15);
}

[data-theme="dark"] .status-failed {
    background: rgba(239, 68, 68, 0.15);
}

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
}

.count-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.count-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.count-success {
    background: var(--color-success-light);
    color: var(--color-success);
}

.count-neutral {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

[data-theme="dark"] .count-danger {
    background: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .count-warning {
    background: rgba(245, 158, 11, 0.15);
}

[data-theme="dark"] .count-success {
    background: rgba(16, 185, 129, 0.15);
}

.action-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.no-data {
    text-align: center;
    padding: 60px 20px !important;
    color: var(--text-tertiary);
}

.no-data i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-data p {
    font-size: 16px;
}

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.page-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== Toast提示 ==================== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    display: none;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.show {
    display: flex;
}

.toast.success {
    border-left: 4px solid var(--color-success);
}

.toast.error {
    border-left: 4px solid var(--color-danger);
}

.toast.info {
    border-left: 4px solid var(--color-info);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==================== 弹窗 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--color-danger);
    color: white;
}

.modal-body {
    padding: 24px;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .stats-panel {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .section-actions {
        width: 100%;
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
        flex-wrap: wrap;
    }

    .usage-cards {
        grid-template-columns: 1fr;
    }
    
    .usage-card {
        padding: 16px;
    }
    
    .usage-number .used {
        font-size: 24px;
    }

    .table-container {
        font-size: 12px;
    }

    .results-table th,
    .results-table td {
        padding: 12px 8px;
    }
}

/* ==================== 加载动画 ==================== */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== 滚动条样式 ==================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

