/* === 变量 === */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #10b981;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

[data-theme="dark"] {
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --primary-light: #a5b4fc;
    --bg-primary: #1e293b;
    --bg-secondary: #0f172a;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
}

/* === 基础 === */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* === 顶部导航 === */
.top-nav {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 24px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.brand-icon {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.brand-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.nav-tabs {
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar { display: none; }

.tool-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

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

.tool-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.tool-tab .tool-icon { font-size: 14px; }

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.theme-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
}

.theme-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* === 主内容 === */
.main-content {
    flex: 1;
    padding: 24px;
}

.tool-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* === 欢迎页 === */
.welcome {
    text-align: center;
    padding: 80px 20px;
}

.welcome h1 {
    font-size: 48px;
    margin-bottom: 16px;
}

.welcome p {
    font-size: 18px;
    color: var(--text-secondary);
}

/* === 工具卡片 === */
.tool-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.tool-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.tool-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* === 工具栏 === */
.toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.toolbar-btn {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

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

.toolbar-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* === 输入输出 === */
.io-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
}

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

.io-box { display: flex; flex-direction: column; gap: 8px; }

.io-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.io-textarea, .io-textarea[readonly] {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    resize: vertical;
    transition: var(--transition);
}

.io-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.io-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    padding: 12px 20px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.action-btn:hover { background: var(--primary-dark); }

.action-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

/* === 结果框 === */
.result-box {
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    word-break: break-all;
}

.result-box.success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--secondary);
    color: var(--secondary);
}

.result-box.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

/* === 选项组 === */
.options-group {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.option-item label {
    font-size: 14px;
    color: var(--text-secondary);
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-wrapper label {
    font-size: 14px;
    color: var(--text-secondary);
}

.slider-wrapper input[type="range"] {
    width: 120px;
    accent-color: var(--primary);
}

.slider-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    min-width: 30px;
}

/* === 颜色选择器 === */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker-wrapper input[type="color"] {
    width: 60px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

/* === 页脚 === */
.footer {
    padding: 20px 24px;
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
    font-size: 13px;
    color: var(--text-muted);
}

.footer a {
    color: var(--primary);
    text-decoration: none;
}

.footer a:hover { text-decoration: underline; }

/* === 响应式 === */
@media (max-width: 1024px) {
    .top-nav { flex-wrap: wrap; }
    .nav-tabs { order: 3; width: 100%; padding-top: 12px; border-top: 1px solid var(--border); margin-top: 12px; }
}

@media (max-width: 768px) {
    .top-nav { padding: 12px 16px; }
    .tool-container { padding: 16px; }
    .tool-card { padding: 16px; }
    .io-container { grid-template-columns: 1fr; }
    .io-actions { flex-direction: row; }
    .category-label { display: none; }
    .tool-tab .tool-name { display: none; }
    .tool-tab { padding: 8px; }
    .welcome h1 { font-size: 32px; }
}

/* === 动画 === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tool-card { animation: fadeIn 0.3s ease; }
