/* YAML转换器工具样式 */
.yaml-converter-tool {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* 统计信息样式 */
.stat-item {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.stat-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #495057;
    display: block;
}

.stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

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

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

/* 上传区域样式 */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #0d6efd;
    background: #e9ecef;
}

.upload-area.dragover {
    border-color: #0d6efd;
    background: #e7f3ff;
    transform: scale(1.02);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon {
    font-size: 3rem;
    color: #6c757d;
}

.upload-area h6 {
    margin: 0;
    color: #495057;
    font-weight: 600;
}

.upload-area p {
    margin: 0;
    font-size: 0.875rem;
    color: #6c757d;
}

/* YAML输入区域样式 */
.yaml-input-container {
    background: #ffffff;
}

.yaml-textarea {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    background: #fafafa;
}

.yaml-textarea:focus {
    box-shadow: none;
    background: #ffffff;
    border-color: #0d6efd;
}

/* YAML信息样式 */
.yaml-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.yaml-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.yaml-info-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.875rem;
}

.yaml-info-value {
    color: #6c757d;
    font-size: 0.875rem;
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* 验证结果样式 */
.validation-container {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.validation-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.validation-item:last-child {
    border-bottom: none;
}

.validation-item.error {
    color: #dc3545;
}

.validation-item.warning {
    color: #ffc107;
}

.validation-item.success {
    color: #28a745;
}

.validation-item.info {
    color: #17a2b8;
}

.validation-icon {
    margin-top: 2px;
}

.validation-message {
    flex: 1;
    font-size: 0.875rem;
}

/* 转换进度样式 */
.conversion-progress {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.progress {
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, #0d6efd, #6610f2);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

/* 转换结果样式 */
.conversion-results {
    background: #ffffff;
}

.result-container {
    position: relative;
}

.result-textarea {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    background: #fafafa;
}

.result-textarea:focus {
    box-shadow: none;
    background: #ffffff;
    border-color: #0d6efd;
}

.result-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #6c757d;
}

.result-stats {
    display: flex;
    gap: 1rem;
}

/* 对比视图样式 */
.comparison-view {
    margin-top: 1rem;
}

.comparison-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.comparison-item {
    text-align: center;
}

.comparison-item h6 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.comparison-item pre {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 0.75rem;
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
    margin: 0;
}

/* 结构预览样式 */
.structure-preview {
    margin-top: 1rem;
}

.tree-container {
    max-height: 300px;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.tree-node {
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.4;
}

.tree-node .tree-line {
    color: #6c757d;
    user-select: none;
}

.tree-node .tree-key {
    color: #0d6efd;
    font-weight: 500;
}

.tree-node .tree-type {
    color: #6f42c1;
    font-style: italic;
}

.tree-node .tree-value {
    color: #198754;
}

.tree-node .tree-null {
    color: #6c757d;
    font-style: italic;
}

/* 高亮显示样式 */
.highlight {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
}

/* 代码高亮样式 */
.code-json,
.code-xml,
.code-toml,
.code-ini,
.code-properties,
.code-env,
.code-docker {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem;
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 错误状态样式 */
.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 1rem;
    color: #721c24;
    font-size: 0.875rem;
    margin: 0.5rem 0;
}

.success-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    padding: 1rem;
    color: #155724;
    font-size: 0.875rem;
    margin: 0.5rem 0;
}

.warning-message {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 1rem;
    color: #856404;
    font-size: 0.875rem;
    margin: 0.5rem 0;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    color: #dee2e6;
    margin-bottom: 1rem;
}

.empty-state h6 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    margin: 0;
}

/* 加载动画 */
.converting {
    position: relative;
    overflow: hidden;
}

.converting::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(13, 110, 253, 0.3), transparent);
    animation: converting 1.5s infinite;
}

@keyframes converting {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* YAML语法高亮 */
.yaml-highlight .yaml-key {
    color: #0d6efd;
    font-weight: 500;
}

.yaml-highlight .yaml-value {
    color: #198754;
}

.yaml-highlight .yaml-string {
    color: #d63384;
}

.yaml-highlight .yaml-number {
    color: #6f42c1;
}

.yaml-highlight .yaml-boolean {
    color: #fd7e14;
    font-weight: 600;
}

.yaml-highlight .yaml-null {
    color: #6c757d;
    font-style: italic;
}

.yaml-highlight .yaml-comment {
    color: #198754;
    font-style: italic;
}

.yaml-highlight .yaml-anchor {
    color: #20c997;
    font-weight: 600;
}

.yaml-highlight .yaml-tag {
    color: #dc3545;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .yaml-info-grid {
        grid-template-columns: 1fr;
    }

    .result-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .result-stats {
        flex-direction: column;
        gap: 0.5rem;
    }

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

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

@media (max-width: 480px) {
    .upload-area {
        padding: 2rem 1rem;
    }

    .upload-icon {
        font-size: 2rem;
    }

    .yaml-textarea,
    .result-textarea {
        font-size: 12px;
    }

    .tree-container {
        font-size: 0.75rem;
    }
}

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

    .stat-item {
        background: #2d3748;
        border-color: #4a5568;
    }

    .stat-item:hover {
        background: #4a5568;
    }

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

    .upload-area {
        background: #2d3748;
        border-color: #4a5568;
        color: #e9ecef;
    }

    .upload-area:hover {
        background: #4a5568;
        border-color: #63b3ed;
    }

    .upload-area.dragover {
        background: #2c5282;
        border-color: #63b3ed;
    }

    .upload-icon {
        color: #a0aec0;
    }

    .upload-area h6 {
        color: #e9ecef;
    }

    .upload-area p {
        color: #a0aec0;
    }

    .yaml-textarea,
    .result-textarea {
        background: #2d3748;
        color: #e9ecef;
        border-color: #4a5568;
    }

    .validation-container,
    .tree-container,
    .comparison-container {
        background: #2d3748;
        border-color: #4a5568;
    }

    .comparison-item pre {
        background: #4a5568;
        border-color: #718096;
    }

    .yaml-info-item {
        background: #2d3748;
        border-color: #4a5568;
    }

    .yaml-info-label {
        color: #e9ecef;
    }

    .code-json,
    .code-xml,
    .code-toml,
    .code-ini,
    .code-properties,
    .code-env,
    .code-docker {
        background: #2d3748;
        border-color: #4a5568;
        color: #e9ecef;
    }
}

/* 打印样式 */
@media print {
    .text-toolbar,
    .conversion-progress,
    .card-header,
    footer {
        display: none !important;
    }

    .yaml-textarea,
    .result-textarea {
        max-height: none;
        overflow: visible;
        border: 1px solid #000;
        background: #fff;
        color: #000;
    }

    .comparison-container {
        break-inside: avoid;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .upload-area {
        border-width: 3px;
        border-color: #000;
    }

    .yaml-textarea,
    .result-textarea {
        border: 2px solid #000;
    }

    .btn {
        border: 2px solid #000;
        font-weight: 600;
    }
}

/* 减少动画偏好支持 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}