@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
    /* 白天模式 (Light Mode) 变量 */
    --bg-base: #f4f4f5;
    --bg-surface: #ffffff;
    --bg-surface-hover: #fafafa;
    
    --border-color: rgba(0, 0, 0, 0.1);
    --border-color-hover: rgba(0, 0, 0, 0.2);
    
    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-muted: #a1a1aa;
    
    --accent-color: #000000;
    --accent-glow: rgba(0, 0, 0, 0.1);
    
    --brand-blue: #0070f3;
    --brand-blue-glow: rgba(0, 112, 243, 0.15);
    
    --status-success: #17c964;
    --status-error: #f31260;
    --status-warning: #f5a524;
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

[data-theme="dark"] {
    /* 夜间模式 (Dark Mode) 变量 */
    --bg-base: #000000;
    --bg-surface: #0a0a0a;
    --bg-surface-hover: #171717;
    
    --border-color: rgba(255, 255, 255, 0.12);
    --border-color-hover: rgba(255, 255, 255, 0.25);
    
    --text-primary: #ededed;
    --text-secondary: #888888;
    --text-muted: #444444;
    
    --accent-color: #ffffff;
    --accent-glow: rgba(255, 255, 255, 0.15);
    
    --brand-blue: #0070f3;
    --brand-blue-glow: rgba(0, 112, 243, 0.2);
    
    --status-success: #17c964;
    --status-error: #f31260;
    --status-warning: #f5a524;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] body {
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(255, 255, 255, 0.03), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(0, 112, 243, 0.04), transparent 25%);
}

[data-theme="light"] body {
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(0, 0, 0, 0.02), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(0, 112, 243, 0.03), transparent 25%);
}

/* Navbar */
.top-navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s ease;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Theme Toggle Button */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}
.theme-toggle:hover {
    transform: scale(1.05);
    border-color: var(--border-color-hover);
    background: var(--bg-surface-hover);
}
.theme-toggle svg { width: 18px; height: 18px; }

/* Main Layout */
.main-container { 
    width: 100%; 
    max-width: 1200px; 
    margin: 0 auto;
    padding: 3rem 2rem;
}

.main-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .main-layout {
        display: flex;
        flex-direction: column;
    }
    .main-container {
        padding: 2rem 1.25rem;
    }
    .nav-content {
        padding: 1rem 1.25rem;
    }
}

/* Headers */
.mobile-only-header { text-align: left; margin-bottom: 2rem; }
@media (min-width: 900px) {
    .mobile-only-header { display: none; }
}
h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}
.subtitle { 
    color: var(--text-secondary); 
    font-size: 0.95rem;
}

.balance-badge {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.5rem 1rem; margin-bottom: 1.5rem; width: 100%;
    border-radius: var(--radius-md); font-size: 0.75rem; font-family: 'JetBrains Mono', monospace;
    background: var(--bg-surface); border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.balance-badge::before {
    content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 8px; background: var(--text-muted);
}
.balance-badge.success::before { background: var(--status-success); box-shadow: 0 0 8px var(--status-success); }
.balance-badge.error::before { background: var(--status-error); box-shadow: 0 0 8px var(--status-error); }

/* Minimalist Panel (Form Area) */
.glass-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color); 
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px -10px rgba(0,0,0,0.1);
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

[data-theme="dark"] .glass-panel {
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
}

.glass-panel::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color-hover), transparent);
}

/* Tabs */
.tabs { 
    display: flex; 
    border-bottom: 1px solid var(--border-color); 
    overflow-x: auto; 
    background: var(--bg-base);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    flex: 1; padding: 1.25rem 0.5rem; background: none; border: none;
    color: var(--text-secondary); font-weight: 500; font-size: 0.85rem;
    cursor: pointer; transition: all 0.2s ease; white-space: nowrap;
    position: relative;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--text-primary); }
.tab.active::after {
    content: ''; position: absolute; bottom: -1px; left: 15%; right: 15%; height: 2px;
    background: var(--accent-color);
    box-shadow: 0 -2px 10px var(--accent-glow);
}

/* Forms */
.tab-content { padding: 2.5rem 2rem; background: var(--bg-surface); }
@media (max-width: 480px) { .tab-content { padding: 1.5rem; } }

.form-section { display: none; animation: fadeSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.form-section.active { display: block; }

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

h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 2rem; color: var(--text-primary); letter-spacing: -0.02em; }
.form-group { margin-bottom: 1.5rem; position: relative; }

label { 
    display: block; margin-bottom: 0.4rem; font-size: 0.75rem; 
    color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500;
}

input, select, textarea {
    width: 100%; padding: 0.85rem 1rem; background: var(--bg-base);
    border: 1px solid var(--border-color); border-radius: var(--radius-md);
    color: var(--text-primary); font-family: inherit; font-size: 0.95rem; 
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}
input:hover, select:hover, textarea:hover { border-color: var(--border-color-hover); }
input:focus, select:focus, textarea:focus { 
    outline: none; border-color: var(--text-secondary); 
    box-shadow: 0 0 0 1px var(--text-secondary), inset 0 1px 2px rgba(0,0,0,0.05); 
}

/* Valid / Invalid States */
input.valid {
    border-color: var(--status-success) !important;
    box-shadow: 0 0 0 1px var(--status-success), inset 0 1px 2px rgba(0,0,0,0.05) !important;
}
input.invalid {
    border-color: var(--status-error) !important;
    box-shadow: 0 0 0 1px var(--status-error), inset 0 1px 2px rgba(0,0,0,0.05) !important;
}

/* Input Icon Toggle */
.has-icon input {
    padding-right: 2.5rem;
}
.input-icon-toggle {
    position: absolute; right: 0.5rem; top: 1.8rem;
    width: 32px; height: 32px; padding: 0;
    background: transparent; border: none; color: var(--text-muted);
    box-shadow: none; display: flex; align-items: center; justify-content: center;
}
.input-icon-toggle:hover {
    color: var(--text-primary); transform: none; background: transparent; box-shadow: none;
}
[data-theme="dark"] .input-icon-toggle { box-shadow: none; }

textarea { resize: vertical; font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--text-muted); }

/* Buttons */
button {
    width: 100%; padding: 0.9rem; border: none; border-radius: var(--radius-md);
    font-weight: 500; font-size: 0.95rem; cursor: pointer; transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex; justify-content: center; align-items: center; gap: 8px;
}
.btn-primary { 
    background: var(--text-primary); color: var(--bg-base); margin-top: 1.5rem; 
    box-shadow: 0 4px 14px 0 rgba(0,0,0,0.1);
}
[data-theme="dark"] .btn-primary { box-shadow: 0 4px 14px 0 rgba(255,255,255,0.1); }
.btn-primary:hover { 
    transform: scale(1.02);
    opacity: 0.9;
}
.btn-secondary { 
    background: transparent; color: var(--text-primary); margin-top: 1.5rem; 
    border: 1px solid var(--border-color);
}
.btn-secondary:hover { background: var(--bg-surface-hover); border-color: var(--border-color-hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* Messages & Results */
.hidden { display: none !important; }

.message-box, .result-box { 
    margin-top: 1.5rem; padding: 1rem 1.25rem; border-radius: var(--radius-md); 
    font-size: 0.85rem; word-break: break-all; line-height: 1.5;
    border-left: 3px solid transparent;
}
.message-box.success, .result-box.success { background: rgba(23, 201, 100, 0.05); border-left-color: var(--status-success); color: var(--status-success); border-top: 1px solid var(--border-color); border-right: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }
.message-box.error, .result-box.error { background: rgba(243, 18, 96, 0.05); border-left-color: var(--status-error); color: var(--status-error); border-top: 1px solid var(--border-color); border-right: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }
.message-box.info { background: rgba(0, 0, 0, 0.02); border-left-color: var(--text-primary); color: var(--text-primary); border-top: 1px solid var(--border-color); border-right: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }
[data-theme="dark"] .message-box.info { background: rgba(255, 255, 255, 0.03); }

pre { white-space: pre-wrap; font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.5rem; }

/* Sidebar & Tutorial */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tutorial-section {
    background: var(--bg-surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px -10px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}
[data-theme="dark"] .tutorial-section {
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
}

.tutorial-steps {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.tutorial-step {
    background: var(--bg-base);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.step-badge {
    color: var(--brand-blue);
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.tutorial-step h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.tutorial-step p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.tutorial-step code {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
}

.tutorial-warning {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--border-color);
    font-size: 0.8rem;
    color: var(--status-warning);
    line-height: 1.5;
}

/* Ad Banner */
.ad-banner {
    display: block;
    text-align: center;
    background: linear-gradient(90deg, rgba(0, 112, 243, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.05);
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease-out;
}
.ad-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.5);
}

/* Job Tracker Overlay */
.job-tracker {
    position: fixed; bottom: 2rem; right: 2rem;
    background: var(--bg-base); 
    border: 1px solid var(--border-color); padding: 1rem 1.5rem;
    border-radius: var(--radius-md); display: flex; align-items: center; gap: 1rem;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.15); z-index: 50;
    animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-theme="dark"] .job-tracker {
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.8);
}

@keyframes slideIn { from { transform: translateY(100%) scale(0.95); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.spinner {
    width: 18px; height: 18px; border: 2px solid var(--border-color);
    border-top-color: var(--text-primary); border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tracker-text h4 { font-size: 0.85rem; font-weight: 500; margin-bottom: 0.1rem; color: var(--text-primary); }
.tracker-text p { font-size: 0.75rem; color: var(--text-secondary); font-family: 'JetBrains Mono', monospace;}

.status-badge {
    display: inline-block; padding: 0.15rem 0.4rem; border-radius: var(--radius-sm); font-size: 0.7rem; font-weight: 600; text-transform: uppercase; font-family: 'JetBrains Mono', monospace; letter-spacing: 0.05em;
}
.status-badge.queued { background: var(--bg-surface); color: var(--text-secondary); border: 1px solid var(--border-color); }
.status-badge.running { background: rgba(0, 112, 243, 0.1); color: var(--brand-blue); border: 1px solid var(--brand-blue-glow); }
.status-badge.success { background: rgba(23, 201, 100, 0.1); color: var(--status-success); border: 1px solid rgba(23, 201, 100, 0.2); }
.status-badge.failed { background: rgba(243, 18, 96, 0.1); color: var(--status-error); border: 1px solid rgba(243, 18, 96, 0.2); }
.status-badge.cancelled { background: var(--bg-surface); color: var(--text-muted); border: 1px solid var(--border-color); }
