/* JSON 转换器专属样式 */

/* ==================== 通用样式（从styles.css复制） ==================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header h1 {
    font-size: 16px;
    font-weight: 600;
}

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

/* 行号样式 */
.line-numbers {
    min-width: 40px;
    padding: 12px 8px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    color: var(--text-tertiary);
    font-family: var(--font-family-mono);
    font-size: 14px;
    line-height: 1.5;
    text-align: right;
    user-select: none;
    overflow: hidden;
}

/* 错误高亮 - 已禁用，只使用toast提示 */
.error-highlight {
    display: none !important;
}

/* ==================== 基础布局样式 ==================== */
.json-container {
    display: flex;
    position: relative;
    height: calc(100vh - 55px);
    margin-top: 20px;
    gap: 20px;
}

.json-input-section, .json-output-section {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.json-input-section {
    flex: 1;
}

.json-output-section {
    flex: 1;
}

/* JSON编辑器容器样式 */
.json-editor-container {
    position: relative;
    display: flex;
    border: 1px solid var(--border-color);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    background-color: var(--bg-tertiary);
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.json-editor-container textarea {
    border: none;
    border-radius: 0;
    background-color: transparent;
    resize: none;
    outline: none;
    padding: 12px;
    flex: 1;
    min-height: 300px;
    font-family: var(--font-family-mono);
    font-size: 14px;
    line-height: 1.5;
    overflow-y: auto;
    letter-spacing: 0;
    word-spacing: 0;
    box-sizing: border-box;
    color: var(--text-primary);
}

/* 状态栏样式 */
.editor-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.cursor-position {
    font-family: var(--font-family-mono);
}

.editor-info {
    display: flex;
    gap: 8px;
    align-items: center;
}

.separator {
    color: var(--border-color);
}

/* 格式选择器样式 */
.format-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 8px;
}

.format-selector-wrapper label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.format-select {
    padding: 6px 12px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    min-width: 100px;
}

.format-select:hover {
    border-color: var(--accent-light);
}

.format-select:focus {
    border-color: var(--accent-hover);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 中央转换控制栏 */
.converter-control-bar {
    position: absolute;
    left: 50%;
    top: -2px;
    transform: translateX(-50%);
    z-index: 100;
    /* background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); */
    display: flex;
    width: auto;
}

.conversion-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-convert {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--success-color), var(--accent-light));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.btn-convert:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

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

.arrow-icon {
    font-size: 16px;
    font-weight: bold;
}

.btn-swap {
    padding: 8px 12px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-swap:hover {
    background-color: var(--nav-hover);
    border-color: var(--accent-light);
    transform: rotate(180deg);
}

.swap-icon {
    display: inline-block;
    font-size: 16px;
    font-weight: bold;
}

/* 高级选项模态框 */
.options-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.options-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.options-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.options-modal .modal-content {
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.options-modal .modal-header h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin: 0;
}

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

.options-modal .modal-close:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.options-modal .modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

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

/* 选项表单样式 */
.option-group {
    margin-bottom: 24px;
}

.option-group:last-child {
    margin-bottom: 0;
}

.option-group h4 {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 500;
}

.option-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
}

.option-item:last-child {
    margin-bottom: 0;
}

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

.option-control input[type="number"],
.option-control select {
    padding: 6px 12px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    min-width: 120px;
}

.option-control input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-hover);
}

/* 文档部分样式增强 */
.shortcuts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.shortcut-item {
    padding: 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.shortcut-key {
    display: inline-block;
    padding: 4px 12px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent-light);
    margin-bottom: 8px;
}

.shortcut-item p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.section-header-left {
    padding-right: 110px;
}

.section-header-right {
    padding-left: 110px;
}

/* 响应式设计 */
@media (max-width: 1300px) {
    .converter-control-bar{
        top: -5px;
    }
    #clearLeft{
        display: none;
    }
    #exportRight{
        display: none;
    }
    #formatRight{
        display: none;
    }
    #formatLeft{
        display: none;
    }
    .section-header-left {
        padding-right: 75px;
    }
    .section-header-right {
        padding-left: 75px;
    }
    .section-header h1 {
        font-size: 14px;
    }
    .btn-convert {
        gap: 2px;
        padding: 2px 6px;
        font-size: 12px;
    }
    .btn-swap {
        padding: 2px 6px;
        font-size: 12px;
    }

    .btn-convert {
        width: 100%;
        justify-content: center;
    }

    .format-selector-wrapper {
        flex-wrap: wrap;
    }
}

/* 错误提示增强 */
.error-message {
    padding: 12px 16px;
    background-color: var(--bg-error);
    border: 1px solid var(--error-deep);
    border-radius: 8px;
    color: var(--error-color);
    font-size: 13px;
    line-height: 1.6;
}

.error-message strong {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
}

/* 成功提示 */
.success-message {
    padding: 12px 16px;
    background-color: var(--bg-green);
    border: 1px solid var(--accent-light);
    border-radius: 8px;
    color: var(--accent-light);
    font-size: 13px;
    line-height: 1.6;
}

/* 加载动画 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-hover);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== 导入模态框样式 ==================== */
.import-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.import-modal.active {
    display: flex;
}

.import-content {
    background-color: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: slideInUp 0.3s ease-out;
}

.import-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    border-radius: 12px 12px 0 0;
}

.import-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.btn-close {
    width: 32px;
    height: 32px;
    border: none;
    background-color: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

.import-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.import-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background-color: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

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

.import-tab.active {
    color: var(--accent-light);
    border-bottom-color: var(--accent-light);
    background-color: var(--bg-primary);
}

.import-body {
    padding: 24px;
}

.import-tab-content {
    display: none;
}

.import-tab-content.active {
    display: block;
}

.import-section {
    margin-bottom: 20px;
}

.import-section label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.import-section input[type="file"],
.import-section input[type="url"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.import-section input[type="file"]:focus,
.import-section input[type="url"]:focus {
    outline: none;
    border-color: var(--accent-light);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.import-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.import-hint.warning {
    color: var(--warning-color);
    background-color: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 12px;
}

.import-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    border-radius: 0 0 12px 12px;
}

.import-footer .btn-primary,
.import-footer .btn-secondary {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.import-footer .btn-primary {
    background-color: var(--accent-light);
    border: 1px solid var(--success-color);
    color: white;
}

.import-footer .btn-primary:hover {
    background-color: var(--success-hover);
}

.import-footer .btn-primary:disabled {
    background-color: var(--text-muted);
    border-color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.import-footer .btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.import-footer .btn-secondary:hover {
    background-color: var(--bg-tertiary);
}

/* 模态框动画 */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.import-modal.closing .import-content {
    animation: slideOutDown 0.3s ease-out forwards;
}

@keyframes slideOutDown {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
}

/* ==================== 文档区域样式 ==================== */
.documentation-section {
    margin-top: 24px;
}

.doc-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 32px;
    overflow: hidden;
}

.doc-panel h2 {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}



.doc-content p {
    margin: 12px 0;
    line-height: 1.8;
}

.doc-content ul, .doc-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

.doc-content li {
    margin: 8px 0;
    line-height: 1.8;
}

.doc-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.doc-content code {
    background: var(--bg-tertiary);
    color: var(--accent-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-family-mono);
    font-size: 13px;
}


.feature-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
}

.feature-item:hover {
    border-color: var(--accent-light);
    transform: translateY(-2px);
}

.feature-item h4 {
    color: var(--text-primary);
    font-size: 18px;
    margin: 0 0 12px 0;
}

.feature-item p {
    color: var(--text-secondary);
    margin: 8px 0;
}

.example {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    margin-top: 16px;
    word-break: break-all;
}

.example strong {
    color: var(--text-primary);
}

/* 使用步骤 */
.steps {
    margin: 24px 0;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.step:hover {
    border-color: var(--accent-light);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content h4 {
    color: var(--text-primary);
    margin: 0 0 8px 0;
    font-size: 16px;
}

.step-content p {
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

.practice-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.practice-item:hover {
    border-color: var(--accent-light);
    transform: translateY(-2px);
}

.practice-item h4 {
    color: var(--text-primary);
    margin: 0 0 12px 0;
    font-size: 16px;
}

.practice-item p {
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}
