/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    padding: 40px 20px;
    color: white;
    position: relative;
}

/* 语言切换器 */
.language-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 5px;
}

.lang-btn {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border-color: white;
    font-weight: 600;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* 卡片样式 */
section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 30px;
}

/* 上传区域样式 */
.upload-area {
    border: 3px dashed #ccc;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #667eea;
    background-color: #f8f9ff;
}

.upload-content h3 {
    margin: 20px 0 10px;
    color: #333;
    font-size: 1.5em;
}

.upload-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

/* 按钮样式 */
.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #dee2e6;
    margin: 0 5px;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

/* 图片预览样式 */
.image-preview {
    text-align: center;
    margin: 20px 0;
}

.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* 选项控制样式 */
.options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    justify-self: center;
}

.size-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 180px;
}

.size-controls label {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 5px;
}

.size-controls input[type="range"] {
    width: 150px;
    margin: 5px 0;
}

.size-controls span {
    min-width: 30px;
    font-weight: bold;
    color: #667eea;
    font-size: 1.1em;
}

/* 加载动画样式 */
.loading-section {
    text-align: center;
}

.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loadingText {
    font-size: 1.1em;
    color: #666;
}

/* 预览占位符样式 */
.preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: #f9f9f9;
}

.placeholder-content {
    text-align: center;
    color: #999;
}

.placeholder-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

/* 结果展示样式 */
.result-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

/* Tab切换样式 */
.result-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: #f0f0f0;
    color: #666;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

.tab-btn:hover:not(.active) {
    background: #e0e0e0;
}

/* 结果显示区域 */
.result-display {
    width: 100%;
}

.ascii-image-result {
    text-align: center;
    padding: 20px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ascii-image-result canvas {
    max-width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.ascii-result {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    overflow: auto;
    max-height: 600px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ascii-result pre {
    color: #000000;
    font-family: 'Courier New', monospace;
    font-size: 0.5em;
    line-height: 1.0;
    white-space: pre;
    margin: 0;
    letter-spacing: 0;
}

/* 页脚样式 */
footer {
    text-align: center;
    padding: 20px;
    color: white;
    opacity: 0.8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .language-switcher {
        position: static;
        justify-content: center;
        margin-bottom: 20px;
    }
    
    .container {
        padding: 10px;
    }
    
    section {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .options {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .size-controls {
        min-width: auto;
        width: 100%;
    }
    
    .result-controls {
        flex-direction: column;
    }
    
    .tab-btn {
        padding: 10px 15px;
        font-size: 0.9em;
    }
    
    .ascii-result pre {
        font-size: 0.4em;
    }
}

@media (max-width: 480px) {
    .upload-area {
        padding: 30px 15px;
    }
    
    .upload-icon {
        font-size: 3em;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .lang-btn {
        padding: 6px 10px;
        font-size: 0.8em;
    }
    
    .ascii-result pre {
        font-size: 0.3em;
    }
    
    .width-adjustment-notice {
        top: 60px;
        right: 10px;
        left: 10px;
        padding: 10px 15px;
    }
    
    .notice-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .placeholder-icon {
        font-size: 2em;
    }
    
    .tab-btn {
        padding: 8px 12px;
        font-size: 0.8em;
    }
}

/* 自定义滚动条 */
.ascii-result::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.ascii-result::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.ascii-result::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.ascii-result::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 复制成功提示 */
.copy-success {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

/* 宽度调整提示 */
.width-adjustment-notice {
    position: fixed;
    top: 70px;
    right: 20px;
    background: #667eea;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    z-index: 1000;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

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

.notice-icon {
    font-size: 1.2em;
}

.notice-text {
    font-size: 1em;
}

.notice-detail {
    font-size: 0.9em;
    opacity: 0.9;
    margin-left: 4px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}