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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #ffffff;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: none;
}

.header h1 i {
    margin-right: 15px;
    color: #667eea;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.8;
    font-weight: 300;
    color: #666;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* 上传区域样式 */
.upload-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.upload-section:hover {
    transform: translateY(-2px);
}

.upload-area {
    border: 3px dashed #ddd;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #fafafa;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #e8f2ff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 20px;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #333;
}

.upload-content p {
    color: #666;
    margin-bottom: 10px;
}

.file-info {
    font-size: 0.9rem;
    color: #999;
    margin-bottom: 20px !important;
}

.upload-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.upload-btn i {
    margin-right: 8px;
}

/* 进度条样式 */
.upload-progress {
    margin-top: 20px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-weight: bold;
    color: #667eea;
}

/* 控制面板样式 */
.control-panel {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.control-group {
    margin-bottom: 30px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #333;
    display: flex;
    align-items: center;
}

.control-group h3 i {
    margin-right: 10px;
    color: #667eea;
}

/* 透明度控制样式 */
.opacity-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.slider-container {
    flex: 1;
    min-width: 200px;
}

.opacity-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 10px;
}

.opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.opacity-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #666;
}

.opacity-input-group {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 5px;
}

.opacity-input {
    width: 80px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    font-size: 1rem;
    text-align: center;
    outline: none;
}

.input-unit {
    padding: 8px;
    color: #666;
    font-weight: bold;
}

/* 背景色控制样式 */
.background-controls h4 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: #555;
}

.color-presets {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.color-preset {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: 2px solid transparent;
    border-radius: 10px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.color-preset:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.color-preset.active {
    border-color: #667eea;
    background: #e8f2ff;
}

.color-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #ddd;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

.color-preset span {
    font-size: 0.8rem;
    color: #666;
    text-align: center;
}

.color-picker-container {
    position: relative;
}

.color-picker {
    opacity: 0;
    position: absolute;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.color-picker-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.color-picker-label:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* 下载控制样式 */
.download-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 格式选择样式 */
.format-selection h4 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: #555;
}

.format-options {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.format-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 120px;
}

.format-option:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.format-option input[type="radio"] {
    margin-right: 10px;
    accent-color: #667eea;
}

.format-option input[type="radio"]:checked + .format-label {
    color: #667eea;
}

.format-option:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background: #e8f2ff;
}

.format-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.format-label i {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.format-label strong {
    font-size: 0.9rem;
}

.format-label small {
    font-size: 0.75rem;
    color: #666;
    opacity: 0.8;
}

/* JPG背景色选择样式 */
.jpg-background-color {
    padding: 15px;
    background: #fff8e1;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

.jpg-background-color h4 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: #555;
}

.format-note {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    font-style: italic;
}

.jpg-bg-options {
    display: flex;
    gap: 15px;
}

.jpg-bg-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    transition: all 0.3s ease;
    flex: 1;
}

.jpg-bg-option:hover {
    border-color: #ffc107;
    background: #fffbf0;
}

.jpg-bg-option input[type="radio"] {
    margin-right: 10px;
    accent-color: #ffc107;
}

.jpg-bg-option:has(input[type="radio"]:checked) {
    border-color: #ffc107;
    background: #fff8e1;
}

.jpg-bg-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.jpg-bg-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #ddd;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

/* 文件名输入组样式调整 */
.filename-input-group {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.filename-input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    background: transparent;
    font-size: 1rem;
    outline: none;
}

.file-extension {
    padding: 12px 15px;
    background: #e9ecef;
    color: #666;
    font-weight: bold;
    border-left: 1px solid #ddd;
}

.download-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    white-space: nowrap;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.download-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.download-btn i {
    margin-right: 8px;
}

/* 预览区域样式 */
.preview-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.preview-section h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #333;
    display: flex;
    align-items: center;
}

.preview-section h3 i {
    margin-right: 10px;
    color: #667eea;
}

.preview-container {
    text-align: center;
}

.preview-background {
    display: inline-block;
    padding: 20px;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.preview-canvas {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.preview-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.image-info {
    font-size: 0.9rem;
    color: #666;
}

.current-settings {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: #666;
}

.current-settings strong {
    color: #333;
}

/* 底部样式 */
.footer {
    text-align: center;
    color: #666;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* 提示消息样式 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
    max-width: 300px;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

.toast.warning {
    background: #ffc107;
    color: #333;
}

/* 响应式设计 */
@media (min-width: 768px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "upload upload"
            "controls preview";
    }

    .upload-section {
        grid-area: upload;
    }

    .control-panel {
        grid-area: controls;
    }

    .preview-section {
        grid-area: preview;
    }
}

@media (min-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-areas:
            "upload upload preview"
            "controls controls preview";
    }
}

@media (max-width: 767px) {
    .container {
        padding: 15px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .upload-section,
    .control-panel,
    .preview-section {
        padding: 20px;
    }

    .opacity-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .color-presets {
        justify-content: center;
    }

    .download-controls {
        gap: 15px;
    }

    .format-options {
        flex-direction: column;
        gap: 10px;
    }

    .format-option {
        min-width: auto;
    }

    .jpg-bg-options {
        flex-direction: column;
        gap: 10px;
    }

    .filename-input-group {
        min-width: auto;
    }

    .preview-info {
        flex-direction: column;
        text-align: center;
    }

    .current-settings {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .upload-area {
        padding: 30px 15px;
    }

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

    .color-presets {
        gap: 8px;
    }

    .color-preset {
        min-width: 70px;
        padding: 10px;
    }

    .color-circle {
        width: 25px;
        height: 25px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.control-panel,
.preview-section {
    animation: fadeIn 0.5s ease-out;
}

/* 棋盘格背景（用于透明度预览） */
.checkerboard {
    background-image:
        linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}
