/* XML格式化工具样式 */
.xml-formatter-tool {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* XML显示样式 */
.xml-view {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem;
    max-height: 600px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.xml-element {
    color: #0066cc;
    font-weight: bold;
}

.xml-attribute {
    color: #ff6600;
}

.xml-attribute-value {
    color: #009900;
}

.xml-text {
    color: #333333;
}

.xml-comment {
    color: #999999;
    font-style: italic;
}

.xml-cdata {
    color: #cc0066;
}

.xml-processing-instruction {
    color: #666666;
    font-style: italic;
}

/* XML语法高亮 */
.xml-tag {
    color: #0066cc;
    font-weight: bold;
}

.xml-tag-open {
    color: #0066cc;
    font-weight: bold;
}

.xml-tag-close {
    color: #0066cc;
    font-weight: bold;
}

.xml-namespace {
    color: #cc0066;
    font-weight: bold;
}

.xml-dtd {
    color: #666666;
    font-style: italic;
}

/* 验证状态样式 */
.xml-validation-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.1);
}

.xml-validation-error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.1);
}

.xml-validation-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.1);
}

/* 格式统计样式 */
.xml-format-stats {
    background: linear-gradient(135deg, #e2e3e5 0%, #d6d8db 100%);
    color: #383d41;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.xml-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.xml-stat-item {
    text-align: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
}

.xml-stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #0066cc;
}

.xml-stat-label {
    font-size: 0.8rem;
    color: #666666;
    margin-top: 0.25rem;
}

/* 错误列表样式 */
.xml-error-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.xml-error-item {
    background: rgba(255, 255, 255, 0.5);
    border-left: 4px solid #dc3545;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0 4px 4px 0;
}

.xml-error-line {
    font-weight: bold;
    color: #dc3545;
}

.xml-error-message {
    color: #721c24;
    margin-top: 0.25rem;
}

.xml-error-position {
    font-size: 0.8rem;
    color: #666666;
    margin-top: 0.25rem;
}

/* XML树结构样式 */
.xml-tree {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
}

.xml-tree-node {
    margin-left: 1rem;
    position: relative;
}

.xml-tree-node::before {
    content: '├─';
    position: absolute;
    left: -1rem;
    color: #dee2e6;
}

.xml-tree-node:last-child::before {
    content: '└─';
}

.xml-tree-leaf {
    margin-left: 1rem;
    position: relative;
}

.xml-tree-leaf::before {
    content: '├─ ';
    position: absolute;
    left: -1rem;
    color: #dee2e6;
}

.xml-tree-leaf:last-child::before {
    content: '└─ ';
}

/* 行号样式 */
.xml-line-numbers {
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    color: #6c757d;
    padding: 0.5rem;
    text-align: right;
    user-select: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
}

.xml-content-with-lines {
    display: flex;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
}

.xml-lines-container {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    max-height: 600px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

/* 格式化选项样式 */
.xml-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.xml-option-group {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.xml-option-group h6 {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.xml-option {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

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

.xml-option input[type="checkbox"] {
    margin-right: 0.5rem;
}

.xml-option label {
    margin-bottom: 0;
    cursor: pointer;
    user-select: none;
}

/* 工具栏样式 */
.xml-toolbar {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.xml-toolbar .btn {
    min-width: 80px;
}

.xml-toolbar-divider {
    width: 1px;
    height: 24px;
    background: #dee2e6;
    margin: 0 0.5rem;
}

/* 拖拽区域样式 */
.xml-drop-zone {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    color: #6c757d;
    transition: all 0.3s ease;
    cursor: pointer;
}

.xml-drop-zone:hover {
    border-color: #007bff;
    background: #f8f9fa;
}

.xml-drop-zone.dragover {
    border-color: #007bff;
    background: #e3f2fd;
    color: #0066cc;
}

.xml-drop-zone-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #6c757d;
}

.xml-drop-zone-text {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.xml-drop-zone-hint {
    font-size: 0.9rem;
    color: #868e96;
}

/* 状态指示器 */
.xml-status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.xml-status-valid {
    background: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.3);
}

.xml-status-invalid {
    background: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.3);
}

.xml-status-warning {
    background: #ffc107;
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.3);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .xml-format-buttons {
        flex-direction: column;
    }

    .xml-format-buttons .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .xml-options-grid {
        grid-template-columns: 1fr;
    }

    .xml-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .xml-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .xml-toolbar-divider {
        width: auto;
        height: 1px;
        margin: 0.5rem 0;
    }

    .xml-content-with-lines {
        flex-direction: column;
    }

    .xml-line-numbers {
        border-right: none;
        border-bottom: 1px solid #dee2e6;
        text-align: left;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 480px) {
    .xml-stats-grid {
        grid-template-columns: 1fr;
    }

    .xml-option-group {
        padding: 0.75rem;
    }

    .xml-drop-zone {
        padding: 1rem;
    }

    .xml-drop-zone-icon {
        font-size: 2rem;
    }
}

/* 深色主题支持 */
@media (prefers-color-scheme: dark) {
    .xml-formatter-tool {
        background: #1a1a1a;
        color: #e9ecef;
    }

    .xml-view {
        background: #2d3748;
        border-color: #4a5568;
        color: #e9ecef;
    }

    .xml-validation-success {
        background: linear-gradient(135deg, #2d5a3d 0%, #22543d 100%);
        color: #9ae6b4;
        border-color: #22543d;
    }

    .xml-validation-error {
        background: linear-gradient(135deg, #5a2d2d 0%, #542d2d 100%);
        color: #feb2b2;
        border-color: #542d2d;
    }

    .xml-validation-warning {
        background: linear-gradient(135deg, #5a5a2d 0%, #54542d 100%);
        color: #faf089;
        border-color: #54542d;
    }

    .xml-format-stats {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
        color: #e2e8f0;
    }

    .xml-option-group {
        background: #2d3748;
        border-color: #4a5568;
        color: #e9ecef;
    }

    .xml-toolbar {
        background: #2d3748;
        border-color: #4a5568;
    }

    .xml-drop-zone {
        background: #2d3748;
        border-color: #4a5568;
        color: #a0aec0;
    }

    .xml-drop-zone:hover {
        border-color: #63b3ed;
        background: #2b6cb0;
        color: #bee3f8;
    }

    .xml-drop-zone.dragover {
        border-color: #63b3ed;
        background: #2b6cb0;
        color: #bee3f8;
    }
}