/* ========================================
   CSS Variables
======================================== */
:root {
    /* 赛博朋克配色 */
    --cyber-pink: #FF006E;
    --cyber-cyan: #00F5FF;
    --cyber-yellow: #FFFF00;
    --cyber-purple: #8B5CF6;
    --cyber-green: #00FF41;
    --cyber-blue: #0066FF;

    /* 主色调 */
    --primary-color: var(--cyber-cyan);
    --primary-hover: var(--cyber-pink);
    --danger-color: #FF3366;
    --danger-hover: #CC0044;
    --success-color: var(--cyber-green);

    /* 背景色 */
    --bg-primary: #0A0E27;
    --bg-secondary: #1A1F3A;
    --bg-dark: #000000;
    --bg-card: rgba(26, 31, 58, 0.8);

    /* 文字颜色 */
    --text-primary: #E0E7FF;
    --text-secondary: #64748B;
    --text-glow: #00F5FF;

    /* 边框和阴影 */
    --border-color: rgba(0, 245, 255, 0.3);
    --border-glow: rgba(255, 0, 110, 0.5);
    --shadow-sm: 0 0 10px rgba(0, 245, 255, 0.2);
    --shadow-md: 0 0 20px rgba(255, 0, 110, 0.3);
    --shadow-lg: 0 0 40px rgba(139, 92, 246, 0.4);
    --shadow-neon: 0 0 20px currentColor, 0 0 40px currentColor;

    /* 布局 */
    --sidebar-width: 300px;
    --navbar-height: 70px;
}

/* ========================================
   Reset & Base Styles
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto;
    color: var(--text-primary);
    background: linear-gradient(180deg, #0A0E27 0%, #1A1F3A 50%, #0A0E27 100%);
    overflow-y: auto;
    min-height: 100vh;
    zoom: 1.4;
    position: relative;
}

/* 赛博朋克网格背景 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0, 245, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 0, 110, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
    animation: cyberGrid 30s linear infinite;
}

/* 扫描线效果 */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 245, 255, 0.03) 0px,
        transparent 2px,
        transparent 4px
    );
    pointer-events: none;
    z-index: 1;
    animation: scanline 8s linear infinite;
}

@keyframes cyberGrid {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

@keyframes scanline {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* ========================================
   Cyberpunk Glitch Effects
======================================== */
.glitch {
    position: relative;
    animation: glitch 3s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--cyber-cyan);
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim 2s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 var(--cyber-pink);
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 3s infinite linear alternate-reverse;
}

@keyframes glitch {
    0% { transform: none; opacity: 1; }
    7% { transform: skew(-0.5deg, -0.9deg); opacity: 0.75; }
    10% { transform: none; opacity: 1; }
    27% { transform: none; opacity: 1; }
    30% { transform: skew(0.8deg, -0.1deg); opacity: 0.75; }
    35% { transform: none; opacity: 1; }
    52% { transform: none; opacity: 1; }
    55% { transform: skew(-1deg, 0.2deg); opacity: 0.75; }
    50% { transform: none; opacity: 1; }
    72% { transform: none; opacity: 1; }
    75% { transform: skew(0.4deg, 1deg); opacity: 0.75; }
    80% { transform: none; opacity: 1; }
    100% { transform: none; opacity: 1; }
}

@keyframes glitch-anim {
    0% { clip: rect(10px, 9999px, 31px, 0); }
    20% { clip: rect(85px, 9999px, 140px, 0); }
    40% { clip: rect(48px, 9999px, 95px, 0); }
    60% { clip: rect(28px, 9999px, 67px, 0); }
    80% { clip: rect(70px, 9999px, 112px, 0); }
    100% { clip: rect(42px, 9999px, 88px, 0); }
}

/* 霓虹发光文字 */
.neon-text {
    color: var(--cyber-cyan);
    text-shadow:
        0 0 10px var(--cyber-cyan),
        0 0 20px var(--cyber-cyan),
        0 0 30px var(--cyber-cyan),
        0 0 40px var(--cyber-pink);
    animation: neonPulse 2s ease-in-out infinite;
}

@keyframes neonPulse {
    0%, 100% {
        text-shadow:
            0 0 10px var(--cyber-cyan),
            0 0 20px var(--cyber-cyan),
            0 0 30px var(--cyber-cyan),
            0 0 40px var(--cyber-pink);
    }
    50% {
        text-shadow:
            0 0 5px var(--cyber-cyan),
            0 0 10px var(--cyber-cyan),
            0 0 15px var(--cyber-cyan),
            0 0 20px var(--cyber-pink);
    }
}

/* ========================================
   Login Page
======================================== */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0A0E27 0%, #1a1f3a 50%, #2a1f4a 100%);
    z-index: 9999;
    zoom: 1;
    overflow: hidden;
}

/* 涟漪网格背景 */
.ripple-grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

.ripple-grid-bg canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.login-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    max-height: 360px;
    background: linear-gradient(135deg, rgba(26, 31, 58, 0.95), rgba(55, 65, 81, 0.95));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 16px;
    box-shadow: 0 0 80px rgba(139, 92, 246, 0.4),
                0 20px 60px rgba(0, 0, 0, 0.6),
                inset 0 0 0 2px rgba(167, 139, 250, 0.3);
    padding: 20px 30px 12px 30px;
    animation: fadeInUp 0.6s ease-out;
    z-index: 10;
    overflow: hidden;
}

.login-box::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 50%, #8B5CF6 100%);
    border-radius: 16px;
    z-index: -1;
    opacity: 0.6;
    animation: borderPulse 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes borderPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.8; }
}

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

.login-header {
    text-align: center;
    margin-bottom: 12px;
}

.login-logo {
    font-size: 26px;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 2px;
}

.login-subtitle {
    font-size: 12px;
    color: #D1D5DB;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    background-color: rgba(31, 41, 55, 0.8);
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: #8B5CF6;
    background-color: rgba(31, 41, 55, 1);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3),
                0 0 20px rgba(139, 92, 246, 0.2);
    transform: translateY(-1px);
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 38px;
    cursor: pointer;
    font-size: 20px;
    user-select: none;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.password-toggle:hover {
    color: var(--primary-color);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #FFFFFF;
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.btn-login {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #8B5CF6 0%, #6366F1 100%);
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
    position: relative;
    overflow: hidden;
    margin: 0;
}

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

.btn-login:hover::before {
    left: 100%;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(139, 92, 246, 0.6);
    background: linear-gradient(135deg, #7C3AED 0%, #5B21B6 100%);
}

.btn-login:active {
    transform: translateY(0);
}

.login-error {
    padding: 0;
    margin: 0;
    background-color: rgba(239, 68, 68, 0.2);
    border-left: 3px solid var(--danger-color);
    border-radius: 4px;
    color: #FCA5A5;
    font-size: 14px;
    height: 0;
    overflow: hidden;
    transition: all 0.3s;
}

.login-error:not([style*="display: none"]) {
    padding: 12px;
    height: auto;
}

.app-container {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ========================================
   Navbar
======================================== */
.navbar {
    height: var(--navbar-height);
    background-color: var(--bg-primary);
    border-bottom: 2px solid transparent;
    background-image: linear-gradient(var(--bg-primary), var(--bg-primary)),
                      linear-gradient(90deg, #3B82F6, #8B5CF6, #3B82F6);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15),
                0 0 40px rgba(139, 92, 246, 0.1);
    position: relative;
    z-index: 100;
    animation: navbarGlow 3s ease-in-out infinite;
}

@keyframes navbarGlow {
    0%, 100% { box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15), 0 0 40px rgba(139, 92, 246, 0.1); }
    50% { box-shadow: 0 4px 25px rgba(59, 130, 246, 0.25), 0 0 50px rgba(139, 92, 246, 0.2); }
}

.navbar-left {
    display: flex;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: var(--bg-secondary);
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.user-avatar {
    font-size: 18px;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--danger-color);
    animation: pulse 2s infinite;
}

.status-dot.active {
    background-color: var(--success-color);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   Main Container - 三栏布局
======================================== */
.main-container {
    display: flex;
    min-height: calc(100vh - var(--navbar-height));
    gap: 0;
}

/* ========================================
   Left Panel - 参数控制区 (20%)
======================================== */
.left-panel {
    width: 20%;
    min-width: 250px;
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.left-panel::-webkit-scrollbar {
    width: 6px;
}

.left-panel::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

/* ========================================
   Middle Panel - 上传区域 (20%)
======================================== */
.middle-panel {
    width: 20%;
    min-width: 250px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.middle-panel::-webkit-scrollbar {
    width: 6px;
}

.middle-panel::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

.upload-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: rgba(55, 65, 81, 0.6); /* 半透明背景 */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.1);
    transition: all 0.3s ease;
}

.upload-section:hover {
    background-color: rgba(55, 65, 81, 0.7);
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

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

/* ========================================
   Right Panel - 结果展示区 (50%)
======================================== */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-primary);
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 14px;
    color: var(--text-secondary);
}

.control-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: rgba(55, 65, 81, 0.6); /* 半透明背景 */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.1);
    transition: all 0.3s ease;
}

.control-section:hover {
    background-color: rgba(55, 65, 81, 0.7);
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.control-label {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.control-select,
.control-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    color: var(--text-primary);
    background-color: #1F2937;
    transition: border-color 0.2s;
}

.control-select:focus,
.control-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.control-textarea {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.control-range {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--primary-color), var(--primary-color)) no-repeat var(--border-color);
    background-size: 40% 100%;
    outline: none;
    -webkit-appearance: none;
}

.control-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: var(--primary-color);
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.control-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-md);
}

/* 输入框+滑块组合 */
.input-with-range {
    display: flex;
    gap: 12px;
    align-items: center;
}

.control-input-number {
    width: 70px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    color: var(--text-primary);
    background-color: #1F2937;
    text-align: center;
    transition: border-color 0.2s;
}

.control-input-number:focus {
    outline: none;
    border-color: var(--primary-color);
}

.input-with-range .control-range {
    flex: 1;
}

/* ========================================
   Upload Area
======================================== */
.upload-box {
    border: 2px dashed rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: rgba(31, 41, 55, 0.5);
    position: relative;
    overflow: hidden;
}

.upload-box::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2), transparent);
    transform: translate(-50%, -50%);
    transition: all 0.5s ease;
}

.upload-box:hover {
    border-color: rgba(59, 130, 246, 0.6);
    background-color: rgba(55, 65, 81, 0.6);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
    transform: scale(1.02);
}

.upload-box:hover::before {
    width: 300px;
    height: 300px;
}

.upload-box.dragover {
    border-color: #3B82F6;
    background-color: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.5),
                inset 0 0 40px rgba(59, 130, 246, 0.2);
    transform: scale(1.05);
    animation: magnetPulse 0.6s ease;
}

@keyframes magnetPulse {
    0%, 100% { transform: scale(1.05); }
    50% { transform: scale(1.08); }
}

.upload-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.upload-text {
    font-size: 16px;
    color: var(--text-secondary);
}

.upload-preview {
    position: relative;
    margin-top: 12px;
}

.upload-preview img {
    width: 100%;
    max-height: 150px;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: var(--shadow-md);
}

.upload-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--danger-color);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.upload-remove:hover {
    transform: scale(1.1);
}

/* ========================================
   Buttons
======================================== */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-settings {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: linear-gradient(135deg, #3B82F6, #8B5CF6);
    color: white;
    width: 100%;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4),
                0 0 40px rgba(139, 92, 246, 0.2);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    animation: btnShine 3s infinite;
}

@keyframes btnShine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563EB, #7C3AED);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.6),
                0 0 60px rgba(139, 92, 246, 0.4);
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    width: 100%;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-secondary {
    background-color: #374151;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #4B5563;
}

.btn-settings {
    background-color: #374151;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-logout {
    background-color: var(--danger-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.btn-logout:hover {
    background-color: var(--danger-hover);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-icon:hover {
    background-color: var(--bg-secondary);
}

/* ========================================
   Progress Bar
======================================== */
.progress-bar {
    margin-top: 12px;
    height: 32px;
    background-color: rgba(17, 24, 39, 0.8);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6, #8B5CF6, #3B82F6);
    background-size: 200% 100%;
    transition: width 0.3s;
    width: 0%;
    position: relative;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6),
                inset 0 0 20px rgba(139, 92, 246, 0.4);
    animation: energyFlow 2s linear infinite;
}

.progress-fill::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: energyShine 1.5s infinite;
}

@keyframes energyFlow {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

@keyframes energyShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 删除旧的 content-area 样式，已被 right-panel 替代 */

/* ========================================
   Tabs
======================================== */
.tabs {
    display: flex;
    gap: 2px;
    background-color: var(--bg-secondary);
    padding: 12px 24px 0;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background-color: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s;
}

.tab-btn:hover {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.tab-btn.active {
    background-color: var(--bg-primary);
    color: var(--primary-color);
    box-shadow: 0 -2px 0 var(--primary-color) inset;
}

/* ========================================
   Tab Content
======================================== */
.tab-content {
    flex: 1; /* Make tab-content fill remaining vertical space */
    background-color: var(--bg-primary);
    overflow: hidden; /* Ensure no double scrollbars */
    display: flex; /* Make it a flex container */
    flex-direction: column;
}

.tab-pane {
    display: none;
    width: 100%;
    flex: 1; /* Use flex to fill available space */
    min-height: 0; /* Allow shrinking to fit container */
    overflow-y: auto; /* Enable vertical scrolling */
    padding: 24px 24px 400px 24px; /* Extreme bottom padding to force content visibility */
}

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

.tab-pane::-webkit-scrollbar {
    width: 8px;
}

.tab-pane::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

/* ========================================
   Toolbar
======================================== */
.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

/* ========================================
   Results Grid (结果网格 - 3列布局)
======================================== */
.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 1200px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

.result-card {
    break-inside: avoid;
    margin-bottom: 20px;
    background-color: rgba(55, 65, 81, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(59, 130, 246, 0.1);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    animation: cardFluidEntry 0.6s ease forwards;
}

@keyframes cardFluidEntry {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    60% {
        transform: translateY(-5px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 为每个卡片添加延迟,创建流体效果 */
.result-card:nth-child(1) { animation-delay: 0s; }
.result-card:nth-child(2) { animation-delay: 0.1s; }
.result-card:nth-child(3) { animation-delay: 0.2s; }
.result-card:nth-child(4) { animation-delay: 0.3s; }
.result-card:nth-child(5) { animation-delay: 0.4s; }
.result-card:nth-child(6) { animation-delay: 0.5s; }
.result-card:nth-child(n+7) { animation-delay: 0.6s; }

.result-card:hover {
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.3),
                0 0 40px rgba(139, 92, 246, 0.2);
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(59, 130, 246, 0.4);
}

.result-card-image {
    width: 100%;
    display: block;
    background-color: #1F2937;
    position: relative;
}

.result-card-image img {
    width: 100%;
    display: block;
}

.result-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.result-card-body {
    padding: 12px;
}

.result-card-prompt {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    max-height: 60px;
    overflow: hidden;
}

.result-card-actions {
    display: flex;
    gap: 8px;
}

.result-card-actions button {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background-color: #1F2937;
    color: var(--text-primary);
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.result-card-actions button:hover {
    background-color: #374151;
}

.result-card-checkbox {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    z-index: 10;
}

/* 加载动画 */
.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* 骨架屏 */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, #E0E0E0 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   Prompt Cards
======================================== */
.prompt-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.prompt-card {
    padding: 16px;
    background-color: #374151;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.prompt-card-header {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.prompt-card-text {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ========================================
   History List
======================================== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.history-item {
    padding: 16px;
    background-color: #374151;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-item-time {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-item-mode {
    font-size: 12px;
    color: var(--text-secondary);
}

.history-item-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.history-item-images img {
    width: 100%;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
}

.history-item-images img:hover {
    transform: scale(1.05);
}

/* ========================================
   Modal
======================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: rgba(55, 65, 81, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 80px rgba(59, 130, 246, 0.2);
    animation: modalSlideIn 0.3s;
}

.modal-large {
    max-width: 800px;
    max-height: 65vh; /* Adjusted max height to fit within viewport, considering zoom */
    overflow: hidden; /* Keep this to hide overall modal scrollbar */
    display: flex;
    flex-direction: column;
}

.modal-large .modal-body {
    flex: 1; /* Allow body to grow and shrink, taking available space */
    overflow-y: auto; /* Enable vertical scrolling for body content */
    min-height: 0; /* Important for flex items to shrink below their content size */
    padding-bottom: 20px; /* Add some padding to the bottom of the scrollable area */
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: var(--bg-secondary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.help-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* ========================================
   Toast
======================================== */
.toast {
    position: fixed;
    top: 80px;
    right: 24px;
    background-color: var(--bg-dark);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s;
    z-index: 2000;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* ========================================
   Mode Edit Items
======================================== */
.mode-edit-item {
    margin-bottom: 20px;
    padding: 16px;
    background-color: #374151;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.mode-edit-item-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.mode-edit-item textarea {
    width: 100%;
    min-height: 100px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background-color: #1F2937;
    resize: vertical;
    transition: border-color 0.2s;
}

.mode-edit-item textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ========================================
   API Test Result
======================================== */
.api-test-success {
    color: #6EE7B7;
    padding: 8px;
    background-color: rgba(16, 185, 129, 0.2);
    border-radius: 4px;
    border-left: 3px solid var(--success-color);
}

.api-test-error {
    color: #FCA5A5;
    padding: 8px;
    background-color: rgba(239, 68, 68, 0.2);
    border-radius: 4px;
    border-left: 3px solid var(--danger-color);
}

.api-test-loading {
    color: var(--text-secondary);
    padding: 8px;
    background-color: var(--bg-secondary);
    border-radius: 4px;
}

/* ========================================
   Image Viewer (Lightbox)
======================================== */
.image-viewer {
    display: none;
    position: fixed;
    z-index: 3000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
}

.image-viewer-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90%;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.image-viewer-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 3001;
}

.image-viewer-close:hover,
.image-viewer-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* ========================================
   Account Management
======================================== */
.form-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.account-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.account-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background-color: #374151;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.account-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.account-username {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.account-role {
    font-size: 12px;
    color: var(--text-secondary);
}

.account-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 账号操作按钮 - 统一基础样式 */
.account-btn {
    height: 32px;
    padding: 0 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.account-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.account-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 停用按钮 - 橙色 */
.account-btn-warning {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
}

.account-btn-warning:hover {
    background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
}

/* 启用按钮 - 绿色 */
.account-btn-success {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.account-btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* 改密码按钮 - 蓝色 */
.account-btn-primary {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    padding: 0 10px;
}

.account-btn-primary:hover {
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
}

/* 删除按钮 - 红色 */
.account-btn-danger {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    padding: 0 10px;
}

.account-btn-danger:hover {
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
}

/* 编辑 API 按钮 - 青色 */
.account-btn-info {
    background: linear-gradient(135deg, #06B6D4 0%, #0891B2 100%);
    padding: 0 10px;
}

.account-btn-info:hover {
    background: linear-gradient(135deg, #0891B2 0%, #0E7490 100%);
}

/* ========================================
   Task Panel
======================================== */
.task-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    max-height: 400px;
    font-size: 13px;
    transition: transform 0.3s ease;
}

.task-panel.collapsed {
    transform: translateY(calc(100% - 40px));
}

.task-panel-header {
    padding: 10px 15px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.task-panel-title {
    font-weight: 600;
    color: var(--text-primary);
}

.task-panel-toggle {
    font-size: 12px;
    color: var(--text-secondary);
}

.task-list {
    overflow-y: auto;
    padding: 0;
    margin: 0;
    list-style: none;
    flex: 1;
}

.task-item {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.task-item:hover {
    background-color: var(--bg-primary);
}

.task-item.active {
    background-color: rgba(37, 99, 235, 0.05);
    border-left: 3px solid var(--primary-color);
}

.task-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.task-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.task-status {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--border-color);
    color: var(--text-secondary);
}

.task-status.pending { background: rgba(251, 191, 36, 0.2); color: #FCD34D; }
.task-status.processing { background: rgba(59, 130, 246, 0.2); color: #60A5FA; }
.task-status.completed { background: rgba(16, 185, 129, 0.2); color: #6EE7B7; }
.task-status.failed { background: rgba(239, 68, 68, 0.2); color: #FCA5A5; }

.task-progress-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.task-progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

.task-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    display: flex;
    justify-content: space-between;
}

/* 适配暗色模式 */
@media (prefers-color-scheme: dark) {
    .task-panel {
        background: #1F2937;
        border-color: #374151;
    }
    .task-panel-header {
        background: #111827;
        border-color: #374151;
    }
    .task-item:hover {
        background-color: #374151;
    }
    .task-item.active {
        background-color: rgba(59, 130, 246, 0.1);
    }
}
