/* API Key 测试工具 - 样式表 */

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS 变量定义 */
:root {
    /* 浅色主题 */
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --container-bg: rgba(255, 255, 255, 0.98);
    --text-primary: #333;
    --text-secondary: #888;
    --input-bg: #fafafa;
    --input-bg-hover: #ffffff;
    --input-border: #e8e8e8;
    --input-border-hover: #d0d0d0;
    --result-bg: #fafafa;
    --key-item-bg: white;
    --error-bg: #ffebee;
    --info-bg: #fff3cd;
    --info-border: #ffc107;
    --scrollbar-track: #f1f1f1;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-light: rgba(0, 0, 0, 0.1);
}

/* 黑夜模式 */
body.dark-mode {
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #16213e;
    --container-bg: rgba(30, 30, 46, 0.95);
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --input-bg: #2d2d44;
    --input-bg-hover: #353550;
    --input-border: #404056;
    --input-border-hover: #5a5a70;
    --result-bg: #2d2d44;
    --key-item-bg: #353550;
    --error-bg: #3d2626;
    --info-bg: #3d3820;
    --info-border: #d4a017;
    --scrollbar-track: #2d2d44;
    --shadow-color: rgba(0, 0, 0, 0.6);
    --shadow-light: rgba(0, 0, 0, 0.3);
}

/* 页面布局 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 40px 20px;
    position: relative;
    overflow-x: hidden;
    transition: background 0.4s ease;
}

/* 动态背景装饰 */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: moveBackground 20s linear infinite;
    z-index: 0;
}

@keyframes moveBackground {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--container-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 60px var(--shadow-color), 0 0 0 1px rgba(255, 255, 255, 0.1);
    padding: 40px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
    transition: background 0.4s ease, box-shadow 0.4s ease;
}

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

/* 标题 */
h1 {
    color: var(--text-primary);
    margin-bottom: 40px;
    text-align: center;
    font-size: 2.5em;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(102, 126, 234, 0.1);
    letter-spacing: -0.5px;
    transition: color 0.4s ease;
}

/* 输入区域 */
.input-section {
    margin-bottom: 30px;
    animation: fadeIn 0.5s ease-out backwards;
}

.input-section:nth-child(1) { animation-delay: 0.1s; }
.input-section:nth-child(2) { animation-delay: 0.2s; }
.input-section:nth-child(3) { animation-delay: 0.3s; }
.input-section:nth-child(4) { animation-delay: 0.4s; }
.input-section:nth-child(5) { animation-delay: 0.5s; }

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

label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 15px;
    transition: color 0.4s ease;
}

input[type="text"],
input[type="number"],
textarea,
select,
input[type="file"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--input-border);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: var(--input-bg);
    color: var(--text-primary);
}

input[type="text"]:hover,
input[type="number"]:hover,
textarea:hover,
select:hover {
    border-color: var(--input-border-hover);
    background: var(--input-bg-hover);
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    background: var(--input-bg-hover);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

select {
    cursor: pointer;
}

textarea {
    min-height: 120px;
    resize: vertical;
    font-family: 'Courier New', Consolas, monospace;
    line-height: 1.6;
}

input[type="file"] {
    padding: 10px;
    cursor: pointer;
    font-size: 13px;
}

input[type="file"]::file-selector-button {
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    margin-right: 10px;
    transition: all 0.3s;
}

input[type="file"]::file-selector-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.4s ease;
}

.hint::before {
    content: '💡';
    font-size: 14px;
}

/* 按钮样式 */
button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 40px;
    font-size: 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

button:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 15px rgba(102, 126, 234, 0.4);
}

button:disabled {
    background: linear-gradient(135deg, #ccc 0%, #999 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* 进度条 */
.progress {
    margin: 25px 0;
    display: none;
}

.progress-bar {
    width: 100%;
    height: 35px;
    background: #f0f0f0;
    border-radius: 18px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 13px;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 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%); }
}

/* 结果区域 */
.results {
    margin-top: 40px;
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.result-section {
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.result-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.result-header {
    padding: 18px 20px;
    font-weight: 600;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.result-header.valid {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.result-header.invalid {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
}

.result-header:hover {
    filter: brightness(1.05);
}

.result-body {
    padding: 20px;
    background: var(--result-bg);
    max-height: 400px;
    overflow-y: auto;
    transition: background 0.4s ease;
}

.result-body::-webkit-scrollbar {
    width: 8px;
}

.result-body::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

.result-body::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.result-body::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

.result-body.collapsed {
    display: none;
}

.key-item {
    background: var(--key-item-bg);
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 8px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 13px;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px var(--shadow-light);
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.key-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.key-text {
    word-break: break-all;
    line-height: 1.6;
}

.error-group {
    margin-bottom: 15px;
}

.error-title {
    font-weight: 600;
    color: #d32f2f;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--error-bg);
    border-radius: 6px;
    border-left: 4px solid #d32f2f;
    transition: background 0.4s ease;
}

.toggle-icon {
    transition: transform 0.3s ease;
    display: inline-block;
    font-size: 0.9em;
}

.toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.copy-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 8px 18px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: white;
    transform: scale(1.05);
}

.copy-btn:active {
    transform: scale(0.98);
}

.copy-btn.copied {
    background: rgba(255, 255, 255, 0.5);
}

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

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    transition: transform 0.5s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.stat-card:hover::before {
    transform: translate(-25%, -25%);
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.stat-label {
    font-size: 0.95em;
    opacity: 0.95;
    position: relative;
    z-index: 1;
    font-weight: 500;
}

/* 动画 */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

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

    .container {
        padding: 25px 20px;
        border-radius: 15px;
    }

    h1 {
        font-size: 2em;
        margin-bottom: 30px;
    }

    .stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    button {
        padding: 14px 30px;
        font-size: 15px;
    }
}

/* 页脚装饰 */
.container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 200% 100%;
    animation: gradientMove 3s ease infinite;
}

@keyframes gradientMove {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* 主题切换按钮 */
.theme-toggle-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.theme-toggle-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.theme-toggle-btn:active {
    transform: translateY(-1px) scale(1.02);
}

.theme-icon {
    font-size: 24px;
    transition: transform 0.5s ease;
}

.theme-toggle-btn:hover .theme-icon {
    transform: rotate(20deg);
}

body.dark-mode .theme-toggle-btn {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .theme-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.4);
}

/* 虚拟列表信息框 */
.virtual-list-info {
    padding: 10px;
    background: var(--info-bg);
    border-left: 4px solid var(--info-border);
    margin-bottom: 10px;
    border-radius: 4px;
    color: var(--text-primary);
    transition: background 0.4s ease, color 0.4s ease;
}
