/* ========================================
   Voxel Art Converter - 样式表
   现代暗色主题 + 玻璃态设计
   ======================================== */

/* CSS 变量 */
:root {
    /* 主色调 */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #22d3ee;
    --accent: #f472b6;
    
    /* 背景 */
    --bg-dark: #0f0f1a;
    --bg-card: rgba(30, 30, 50, 0.6);
    --bg-glass: rgba(255, 255, 255, 0.05);
    
    /* 文字 */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* 边框 */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-glow: rgba(99, 102, 241, 0.5);
    
    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    
    /* 尺寸 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* 重置和基础样式 */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* 背景动效 */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.cube {
    position: absolute;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    opacity: 0.1;
    border-radius: var(--radius-sm);
    animation: float 20s infinite ease-in-out;
}

.cube-1 { top: 10%; left: 10%; animation-delay: 0s; }
.cube-2 { top: 60%; left: 80%; animation-delay: -5s; width: 80px; height: 80px; }
.cube-3 { top: 30%; left: 60%; animation-delay: -10s; width: 40px; height: 40px; }
.cube-4 { top: 80%; left: 20%; animation-delay: -15s; width: 100px; height: 100px; }
.cube-5 { top: 50%; left: 40%; animation-delay: -7s; width: 50px; height: 50px; }

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-30px) rotate(90deg);
    }
    50% {
        transform: translateY(0) rotate(180deg);
    }
    75% {
        transform: translateY(30px) rotate(270deg);
    }
}

/* 应用容器 */
.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

/* 头部 */
.header {
    text-align: center;
    padding: 20px 0 30px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    font-size: 2.5rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Header right section */
.header-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Language Switcher */
.lang-switch {
    display: flex;
    gap: 8px;
}

.lang-btn {
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    color: var(--text-primary);
}

.lang-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* 主内容区 */
.main-content {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
    flex: 1;
}

/* 玻璃面板 */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-lg);
}

.glass-panel h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 控制面板 */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 上传区域 */
.upload-zone {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.upload-zone.drag-over {
    transform: scale(1.02);
}

.upload-placeholder {
    text-align: center;
    padding: 20px;
}

.upload-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
}

.upload-placeholder p {
    color: var(--text-secondary);
}

.upload-hint {
    font-size: 0.85rem;
    color: var(--text-muted) !important;
    margin-top: 8px;
}

.preview-image {
    display: none;
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.preview-image.visible {
    display: block;
}

/* 设置组 */
.setting-group {
    margin-bottom: 16px;
}

.setting-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-container input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: var(--shadow-glow);
}

.slider-value {
    min-width: 36px;
    text-align: center;
    font-weight: 600;
    color: var(--primary-light);
}

select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.3s;
}

select:focus {
    outline: none;
    border-color: var(--primary);
}

select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    margin-top: 8px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-export {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-export:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.export-buttons {
    display: flex;
    gap: 12px;
}

.export-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 12px;
}

.btn-icon-only {
    width: 36px;
    height: 36px;
    padding: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    font-size: 1.1rem;
}

.btn-icon-only:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-icon-only.active {
    background: var(--primary);
    border-color: var(--primary);
}

/* 预览面板 */
.preview-panel {
    display: flex;
    flex-direction: column;
    min-height: 500px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.preview-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.preview-controls {
    display: flex;
    gap: 8px;
}

.canvas-container {
    position: relative;
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    overflow: hidden;
    min-height: 400px;
}

#renderCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 15, 26, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.loading-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    color: var(--text-secondary);
}

.preview-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* 底部 */
.footer {
    text-align: center;
    padding: 20px 0 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .control-panel {
        order: 2;
    }
    
    .preview-panel {
        order: 1;
        min-height: 400px;
    }
}

@media (max-width: 600px) {
    .app-container {
        padding: 12px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .export-buttons {
        flex-direction: column;
    }
    
    .glass-panel {
        padding: 16px;
    }
}

/* 进度条动画 */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 16px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.3s ease;
}

/* 工具提示 */
[title] {
    position: relative;
}
