* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --border: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --success: #10b981;
    --error: #ef4444;
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 1rem;
    color: var(--text-primary);
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: var(--background);
    border-radius: 12px;
    box-shadow: 0 20px 60px var(--shadow);
    padding: 1rem;
}

header {
    text-align: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* 模式选择器 */
.mode-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--surface);
    border-radius: 8px;
}

.mode-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--background);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.mode-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 1rem;
    align-items: center;
    font-size: 0.9rem;
}

.language-selector,
.options {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.language-selector label:first-child,
.options label span:first-child {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
}

.radio-group {
    display: flex;
    gap: 1rem;
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    padding: 0.4rem 0.75rem;
    background: var(--background);
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.radio-label:hover,
.checkbox-label:hover {
    background: var(--surface-hover);
}

.radio-label input[type="radio"],
.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.number-input {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
}

.number-input input {
    width: 50px;
    padding: 0.4rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.85rem;
    text-align: center;
}

.number-input input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.editor-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.editor-section {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    background: var(--surface-hover);
    border-bottom: 1px solid var(--border);
}

.header-buttons {
    display: flex;
    gap: 0.5rem;
}

.editor-header h2 {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

textarea {
    flex: 1;
    min-height: 650px;
    padding: 1rem;
    background: var(--background);
    border: none;
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    white-space: pre;
    overflow-x: auto;
    overflow-y: auto;
    word-wrap: normal;
}

textarea.word-wrap {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: hidden;
}

textarea::placeholder {
    color: var(--secondary-color);
}

#outputCode {
    background: #1a1f2e;
}

.action-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.btn-primary svg {
    width: 16px;
    height: 16px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
}

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-1px);
}

.btn-example {
    background: var(--surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
}

.btn-example:hover {
    border-color: var(--primary-color);
    background: var(--surface);
    color: var(--primary-color);
}

.examples {
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.examples h3 {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.example-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.notification {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    background: var(--success);
    color: white;
    font-weight: 500;
    font-size: 0.85rem;
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    background: var(--error);
}

/* 批量处理模式 */
.batch-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.batch-input-section {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow);
}

.batch-input-section textarea {
    min-height: 300px;
}

.batch-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--surface-hover);
    border-top: 1px solid var(--border);
    align-items: center;
}

.batch-actions .btn {
    flex: 1;
}

.batch-format-option {
    margin-right: 0.5rem;
    white-space: nowrap;
}

.batch-results {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow);
}

.batch-status {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: normal;
}

.batch-result-list {
    flex: 1;
    padding: 1rem;
    background: var(--background);
    overflow-y: auto;
    max-height: 600px;
}

.batch-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    color: var(--text-secondary);
    text-align: center;
}

.batch-placeholder svg {
    margin-bottom: 1rem;
    opacity: 0.5;
    stroke: currentColor;
}

.batch-placeholder p {
    font-size: 0.9rem;
}

.batch-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.batch-item:hover {
    border-color: var(--primary-color);
}

.batch-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.batch-item-url {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-family: 'Consolas', monospace;
    word-break: break-all;
    flex: 1;
    margin-right: 0.5rem;
}

.batch-item-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.batch-item-status.loading {
    background: #3b82f6;
    color: white;
}

.batch-item-status.success {
    background: var(--success);
    color: white;
}

.batch-item-status.error {
    background: var(--error);
    color: white;
}

.batch-item-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.batch-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.batch-item-actions .btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

.batch-item-preview {
    max-height: 150px;
    overflow: auto;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.75rem;
    margin-top: 0.5rem;
    font-family: 'Consolas', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text-primary);
    white-space: pre;
    overflow-x: auto;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .editor-container {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        order: 3;
        margin-top: 0.75rem;
    }

    .action-buttons .btn-primary {
        width: 100%;
        justify-content: center;
    }

    .action-buttons .btn-primary svg {
        transform: rotate(90deg);
    }

    textarea {
        min-height: 400px;
    }

    .batch-container {
        grid-template-columns: 1fr;
    }

    .batch-results {
        margin-top: 0.75rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }

    .container {
        padding: 0.75rem;
    }

    header h1 {
        font-size: 1.3rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    textarea {
        min-height: 350px;
        font-size: 0.85rem;
    }
}

