* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --error-color: #dc2626;
    --success-color: #16a34a;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --bg-color: #f9fafb;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
}

/* Color Picker Section */
.color-picker-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.color-picker-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.color-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.color-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
}

.color-input {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input::-webkit-color-swatch {
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.color-hex {
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--text-muted);
    min-width: 70px;
}

.color-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}

.color-remove:hover {
    color: var(--error-color);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.color-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

/* Dropzone */
.dropzone {
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.dropzone-content {
    pointer-events: none;
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.dropzone-text {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.dropzone-subtext {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.dropzone-limit {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

/* Progress */
.progress {
    text-align: center;
    padding: 3rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 0.8s linear infinite;
}

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

/* Error */
.error {
    text-align: center;
    padding: 2rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
}

.error p {
    color: var(--error-color);
    margin-bottom: 1rem;
}

/* Preview */
.preview {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.preview-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.preview-item h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    text-align: center;
}

.preview-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-container img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

/* Checkered background for transparency preview */
.checkered {
    background-image:
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
        linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #ffffff;
}

/* Actions */
.actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
}

/* Utility */
.hidden {
    display: none !important;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .dropzone {
        padding: 2rem 1rem;
    }

    .preview-container img {
        max-height: 250px;
    }
}
