/* --- 1. 全局样式和变量 --- */
:root {
    --primary-color: #6D28D9; /* 深紫色，更专业 */
    --primary-color-light: #EDE9FE;
    --background-color: #F9FAFB; /* 浅灰色背景 */
    --sidebar-bg: #FFFFFF;
    --text-color-primary: #1F2937;
    --text-color-secondary: #6B7280;
    --border-color: #E5E7EB;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color-primary);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- 2. 主布局 --- */
.page-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 420px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.main-content {
    flex-grow: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- 3. 侧边栏样式 --- */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}
.sidebar-header svg {
    color: var(--primary-color);
}
.sidebar-header h1 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.sidebar-section {
    margin-bottom: 24px;
}
.sidebar-section h2 {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 8px 0;
}
.description {
    font-size: 14px;
    color: var(--text-color-secondary);
    line-height: 1.5;
    margin: 0 0 16px 0;
}
textarea, input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #FFF;
    font-size: 14px;
    font-family: monospace;
    transition: border-color 0.2s, box-shadow 0.2s;
}
textarea:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-color-light);
}

/* --- 4. 选项开关样式 --- */
.options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.option-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.option-item label, .option-item-full label {
    font-size: 14px;
    font-weight: 500;
}
.option-item-full {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}
input.toggle-switch {
    position: relative;
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    background-color: #ccc;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}
input.toggle-switch::after {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: var(--shadow-sm);
}
input.toggle-switch:checked {
    background-color: var(--primary-color);
}
input.toggle-switch:checked::after {
    transform: translateX(20px);
}


/* --- 5. 按钮和底部样式 --- */
.sidebar-footer {
    margin-top: auto; 
    padding-top: 24px; 
    border-top: 1px solid var(--border-color); 
}
.footer-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}
.primary-btn {
    flex-grow: 1;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.2s;
}
.primary-btn:hover {
    background-color: #5B21B6;
}
select#lang-switcher {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #fff;
    font-size: 14px;
}
.footer-credit {
    font-size: 12px;
    color: var(--text-color-secondary);
    text-align: center;
    margin-top: 16px; 
    margin-bottom: 0;
}

/* --- 6. 主内容和预览区 --- */
.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-shrink: 0;
}
.output-header h2 {
    font-size: 18px;
    margin: 0;
}
.output-actions {
    display: flex;
    gap: 12px;
}
.secondary-btn {
    background-color: #F3F4F6;
    color: var(--text-color-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}
.secondary-btn:hover {
    background-color: #E5E7EB;
}

.yaml-container {
    background-color: #111827;
    border-radius: var(--radius-lg);
    padding: 16px;
    flex-grow: 1;
    overflow: auto;
    box-shadow: var(--shadow-md);
}
#yaml-output {
    color: #D1D5DB; 
    white-space: pre; 
    word-break: break-all;
    font-family: "SF Mono", "Fira Code", "Source Code Pro", monospace;
    font-size: 14px;
    line-height: 1.6;
}

/* --- 7. 响应式布局 --- */
@media (max-width: 900px) {
    .page-container {
        flex-direction: column;
        height: auto;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        height: auto;
    }
    .main-content {
        height: 60vh; 
    }
}

/* --- 8. 禁用状态样式--- */
fieldset#options-fieldset {
    border: none;
    padding: 0;
    margin: 0;
    transition: opacity 0.3s ease-in-out;
}

fieldset[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

fieldset[disabled] * {
    cursor: not-allowed;
}