:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --secondary: #3f37c9;
    --dark: #1a1a2e;
    --light: #f8f9fa;
    --gray: #6c757d;
    --success: #4cc9f0;
    --danger: #f72585;
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7ff;
    color: var(--dark);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.subtitle {
    color: var(--gray);
    font-size: 1.1rem;
}

.app-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.upload-area {
    border: 2px dashed var(--gray);
    border-radius: var(--border-radius);
    padding: 3rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: var(--primary);
    background-color: rgba(67, 97, 238, 0.05);
}

.upload-area.active {
    border-color: var(--success);
    background-color: rgba(76, 201, 240, 0.05);
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-text {
    margin-bottom: 0.5rem;
}

.browse-btn {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

#file-input {
    display: none;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.control-group {
    flex: 1;
    min-width: 250px;
}

.control-group h3 {
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
    color: var(--dark);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider {
    flex: 1;
    -webkit-appearance: none;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: var(--transition);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider-value {
    width: 50px;
    text-align: center;
    font-weight: 600;
    color: var(--primary);
}

.radio-group {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.radio-option input {
    cursor: pointer;
}

.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: white;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-secondary:hover {
    background-color: rgba(67, 97, 238, 0.1);
}

.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 2rem;
    justify-content: center;
}

.image-box {
    flex: 1;
    min-width: 300px;
    max-width: 450px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.image-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.image-header {
    padding: 1rem;
    background: var(--primary);
    color: white;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
}

.image-content {
    padding: 1rem;
    text-align: center;
}

.image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.image-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.stat {
    text-align: center;
}

.stat-value {
    font-weight: 600;
    color: var(--primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--gray);
}

.download-btn {
    width: 100%;
    margin-top: 1rem;
}

.progress-container {
    width: 100%;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    margin-top: 1rem;
    overflow: hidden;
    display: none;
}

.progress-bar {
    height: 100%;
    background: var(--success);
    width: 0%;
    transition: width 0.3s ease;
}

.batch-progress {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--gray);
    display: none;
}

.file-list {
    margin-top: 1rem;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.file-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid #eee;
    align-items: center;
}

.file-item:last-child {
    border-bottom: none;
}

.file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.file-size {
    font-size: 0.8rem;
    color: var(--gray);
}

.remove-file {
    color: var(--danger);
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1.2rem;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--dark);
    color: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

footer {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translate(-50%);
    margin-top: 2rem;
    color: var(--gray);
    font-size: 0.9rem;
}

/* New styles for preview mode */
.preview-mode {
    display: none;
    text-align: center;
    margin-bottom: 2rem;
}

.uploaded-preview {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--border-radius);
    margin: 1rem auto;
    display: block;
    box-shadow: var(--shadow);
}

.upload-again-btn {
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        gap: 1.5rem;
    }

    .preview-container {
        flex-direction: column;
        align-items: center;
    }

    .image-box {
        width: 100%;
    }
}

/* Animation for upload area */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.upload-area.pulse {
    animation: pulse 1.5s infinite;
}