/* Base64 编解码工具样式 */

/* 主容器布局 */
.base64-container {
    display: flex;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 20px;
}

/* 左侧输入区域 */
.base64-input-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 300px;
    overflow: hidden;
}

/* 右侧输出区域 */
.base64-output-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 300px;
    overflow: hidden;
    margin-bottom: 20px;
}

/* 编辑器容器 */
.base64-editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 结果查看器 */
.base64-result {
    flex: 1;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    overflow-wrap: break-word;
    position: relative;
}

/* 结果区域右上角按钮 */
.result-header-actions {
    position: absolute;
    top: 36px;
    right: 46px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.result-viewer {
    overflow: auto;
    padding-top: 40px; /* 为顶部按钮留出空间 */
    padding: 0;
    margin: 0;
    font-family: var(--font-family-mono);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
}

#resultOutput {
    background-color: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 16px;
    font-family: var(--font-family-mono);
    font-size: 14px;
    line-height: 1.4;
    overflow-x: auto;
    min-height: 200px;
}


.resize-handle {
    width: 12px;
    background-color: var(--bg-primary);
    cursor: col-resize;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    min-width: 8px;
    flex-shrink: 0;
}

.resize-line {
    width: 2px;
    height: 60px;
    background-color: var(--border-color);
    border-radius: 1px;
    transition: background-color 0.2s ease;
}

.resize-handle:hover .resize-line {
    background-color: var(--text-primary);
}

.resize-handle:active .resize-line {
    background-color: var(--text-primary);
}




/* 结果占位符 */
.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    border: 1px dashed var(--border-color);
}

.placeholder-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.4;
    color: var(--text-muted);
}

.placeholder-text {
    font-size: 14px;
    max-width: 280px;
    line-height: 1.4;
    color: var(--text-muted);
    font-weight: 400;
}

/* 错误信息样式 */
.base64-error {
    background-color: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    padding: 16px;
}

.base64-error h4 {
    color: var(--error-color);
    font-size: 14px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #3c1b1a;
}

.base64-error h4::before {
    font-size: 18px;
}

.base64-error .error-message {
    display: block;
    margin-top: 0;
    background-color: transparent;
    border: none;
    border-radius: 0;
    border-left: none;
    padding: 15px 0px;
    font-family: var(--font-family-mono);
    font-size: 13px;
    line-height: 1.5;
}

/* 结果内容样式 */
.result-content {
    font-family: var(--font-family-mono);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding: 16px;
    margin: 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    width: 100%;
    min-height: 120px;
}

/* 成功状态样式 */
.result-success {
    border-left: 3px solid var(--success-color);
    background: var(--success-light);
}

/* 编码结果样式 */
.encoded-result {
    color: var(--accent-light);
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid var(--success-color);
    margin-bottom: 8px;
}

/* 解码结果样式 */
.decoded-result {
    color: var(--accent-light);
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid var(--accent-color);
    margin-bottom: 8px;
    white-space: pre-wrap;
}

/* 结果区域整体样式 */
.result-section {
    padding: 12px;
}

/* 结果标题 */
.result-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* 统计区域整体样式 */
.stats-section {
    margin-top: 16px;
    padding: 12px;

}

/* 统计标题 */
.stats-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

/* 结果统计信息 */
.result-stats {
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
    flex-wrap: nowrap;
    justify-content: space-between;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
}

.stat-label {
    font-weight: 500;
    font-size: 11px;
    white-space: nowrap;
}

.stat-value {
    font-weight: 600;
    font-family: var(--font-family-mono);
    font-size: 11px;
    white-space: nowrap;
}

/* 编码结果样式 */
.encoded-result, .decoded-result {
    font-family: var(--font-family-mono);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    padding: 12px;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: break-word;
}

/* 图片预览容器 */
.image-preview-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.image-preview {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.preview-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    object-fit: contain;
    background: rgba(255, 255, 255, 0.05);
}

.image-info, .decode-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.info-label {
    font-weight: 500;
    color: var(--text-muted);
    min-width: 60px;
    font-size: 12px;
}

.info-value {
    color: var(--text-primary);
    font-family: var(--font-family-mono);
    font-size: 12px;
}

.base64-output {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 12px;
}

.base64-text {
    font-family: var(--font-family-mono);
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-primary);
    background: var(--bg-secondary);
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
    padding: 12px;
    border-radius: 6px;
}

/* 图片解码容器 */
.image-decode-container {
    display: flex;
    justify-content: center;
}

.decoded-image-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* 动画效果 */
.result-fade-in {
    animation: fadeInResult 0.3s ease-in-out;
}

@keyframes fadeInResult {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 处理状态指示器 */
.processing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 14px;
}

.processing-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    border-top-color: var(--accent-light);
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

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

/* 文档区域样式 */
.character-set {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 20px;
    margin: 16px 0;
    border: 1px solid var(--border-color);
}

.charset-item {
    margin-bottom: 16px;
}

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

.charset-item h4 {
    color: var(--accent-light);
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.charset-item code {
    display: block;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 6px;
    font-family: var(--font-family-mono);
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-primary);
    margin: 8px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

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

/* PDF预览容器 */
.pdf-preview-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pdf-preview {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

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

.pdf-viewer iframe {
    width: 100%;
    height: 500px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* 文件结果容器 */
.file-result-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

/* Base64格式容器 */
.base64-formats {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.format-section {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.format-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.format-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.format-description {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
}

.format-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .base64-container {
        flex-direction: column;
        height: auto;
    }
    
    .base64-input-section {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .resize-handle {
        display: none;
    }
    
    .result-title {
        font-size: 12px;
        margin-bottom: 6px;
        padding-bottom: 4px;
    }
    
    .encoded-result, .decoded-result {
        font-size: 12px;
        padding: 10px;
    }
    
    .stats-section {
        padding: 8px;
        margin-top: 12px;
    }
    
    /* 移动端按钮调整 */
    .result-header-actions {
        position: static;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 12px;
    }
    
    .result-viewer {
        padding-top: 0;
    }
    
    .stats-title {
        font-size: 12px;
        margin-bottom: 6px;
        padding-bottom: 4px;
    }
    
    .result-stats {
        flex-direction: column;
        gap: 8px;
    }
    
    .stat-item {
        justify-content: space-between;
        flex: none;
    }
    
    .image-preview {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .preview-image {
        max-width: 150px;
        max-height: 150px;
    }
    
    .base64-text {
        font-size: 10px;
        max-height: 150px;
    }
}

/* 图片Base64优势展示 */
.image-base64-benefits {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.benefit-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.benefit-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.benefit-item h4 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.benefit-item p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

/* 高对比度模式适配 */
@media (prefers-contrast: high) {
    .result-viewer {
        border: 2px solid var(--border-color);
    }
    
    .encoded-result,
    .decoded-result {
        border-width: 2px;
    }
    
    .base64-error {
        border-width: 2px;
    }
    
    .benefit-item {
        border: 2px solid var(--border-color);
    }
}

/* 减少动画模式适配 */
@media (prefers-reduced-motion: reduce) {
    .result-fade-in,
    .processing-spinner {
        animation: none;
    }
}
