/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    color: white;
    padding: 40px 0;
}

.title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 18px;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* Upload Section */
.upload-section {
    margin-bottom: 40px;
}

.upload-area {
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

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

.upload-area.dragging {
    border-color: #667eea;
    background: #edf2f7;
}

.upload-icon {
    color: #a0aec0;
    margin-bottom: 20px;
}

.upload-text {
    font-size: 18px;
    color: #718096;
    margin-bottom: 20px;
}

.upload-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.upload-button:hover {
    background: #5a67d8;
}

.upload-info {
    font-size: 14px;
    color: #a0aec0;
    margin-top: 20px;
}

.file-input {
    display: none;
}

/* Settings Section */
.settings-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
    color: #2d3748;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-label {
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
}

.setting-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Form Controls */
.slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.slider-value {
    min-width: 40px;
    text-align: right;
    font-weight: 600;
    color: #2d3748;
}

.number-input,
.select {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    width: 100%;
    transition: border-color 0.3s;
}

.number-input:focus,
.select:focus {
    outline: none;
    border-color: #667eea;
}

/* Color Palette Editor */
.color-palette-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.color-palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
    padding: 12px;
    background: #f7fafc;
    border-radius: 8px;
    min-height: 60px;
    max-height: 200px;
    overflow-y: auto;
}

.color-item {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.3s;
}

.color-item:hover {
    transform: scale(1.1);
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.color-item-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

.color-item:hover .color-item-remove {
    display: flex;
}

.color-item-add {
    width: 40px;
    height: 40px;
    border: 2px dashed #cbd5e0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a0aec0;
    font-size: 24px;
    transition: all 0.3s;
}

.color-item-add:hover {
    border-color: #667eea;
    color: #667eea;
    background: #f7fafc;
}

.color-picker-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 1001;
}

.color-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.btn-small {
    padding: 6px 16px;
    font-size: 14px;
}

.btn {
    padding: 12px 32px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

/* File List Section */
.file-list-section {
    margin-bottom: 40px;
}

.file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
    background: #f7fafc;
    border-radius: 8px;
}

.file-item {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    position: relative;
    transition: all 0.3s;
}

.file-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.file-item-name {
    font-size: 14px;
    color: #2d3748;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item-size {
    font-size: 12px;
    color: #a0aec0;
    margin-bottom: 8px;
}

.file-item-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
}

.file-item-status.pending {
    background: #e2e8f0;
    color: #4a5568;
}

.file-item-status.processing {
    background: #fef5e7;
    color: #f39c12;
}

.file-item-status.completed {
    background: #d5f4e6;
    color: #27ae60;
}

.file-item-status.error {
    background: #ffeaa7;
    color: #d63031;
}

.file-item-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border: none;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.file-item-remove:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.file-item-thumbnail {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

/* Preview Section */
.preview-section {
    margin-bottom: 40px;
}

.preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
    max-height: 600px;
    overflow-y: auto;
    padding: 16px;
    background: #f7fafc;
    border-radius: 8px;
}

.preview-item {
    background: white;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.preview-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-item-canvas {
    width: 100%;
    max-width: 200px;
    height: auto;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    margin-bottom: 12px;
}

/* Download Section */
.download-section {
    margin-top: 24px;
    text-align: center;
    display: flex;
    gap: 16px;
    justify-content: center;
}

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

.preview-title {
    font-size: 18px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 16px;
}

.preview-canvas {
    width: 100%;
    max-width: 500px;
    height: auto;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #f7fafc;
}

.preview-actions {
    margin-top: 16px;
}

/* Progress Overlay */
.progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.progress-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    min-width: 300px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

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

.progress-text {
    font-size: 18px;
    color: #4a5568;
    margin-bottom: 20px;
}

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

.progress-fill {
    height: 100%;
    background: #667eea;
    width: 0%;
    transition: width 0.3s;
}

/* Footer */
.footer {
    text-align: center;
    color: white;
    padding: 40px 0;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .preview-container {
        grid-template-columns: 1fr;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .title {
        font-size: 32px;
    }
}