:root {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --secondary-color: #95a5a6;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --background: #ecf0f1;
    --surface: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #bdc3c7;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --transition: 0.3s ease;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #1a1a1a;
        --surface: #2d2d2d;
        --text-primary: #ecf0f1;
        --text-secondary: #bdc3c7;
        --border-color: #404040;
        --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
    }
}

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

html,
body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
}

.container {
    display: flex;
    flex-direction: column;
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    padding: 16px;
    gap: 16px;
}

/* Header */
.header {
    text-align: center;
    padding: 24px 16px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.header-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.header-text {
    text-align: left;
}

.header h1 {
    font-size: 32px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-links {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.header-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition);
}

.header-links a:visited {
    color: var(--primary-color);
}

.header-links a:hover {
    color: var(--primary-dark);
    background: rgba(52, 152, 219, 0.1);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 0;
}

/* Main */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

section h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* Upload Section */
.upload-box {
    border: 3px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--surface);
}

.upload-box:hover {
    border-color: var(--primary-color);
    background: var(--surface);
}

.upload-box.dragover {
    border-color: var(--primary-color);
    background: rgba(52, 152, 219, 0.05);
    transform: scale(1.02);
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.upload-box h2 {
    margin: 0 0 8px 0;
    font-size: 18px;
}

.upload-box p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Queue Section */
.queue-container,
.results-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 100px;
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
    background: var(--background);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Queue Item */
.queue-item,
.result-item {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: all var(--transition);
}

.queue-item:hover,
.result-item:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.queue-item.status-processing {
    border: 2px solid var(--primary-color);
}

.queue-item.status-completed {
    border: 2px solid var(--success-color);
}

.queue-item-preview {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--background);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.queue-item-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.queue-item-info,
.result-item-info {
    flex: 1;
    min-width: 0;
}

.queue-item-name,
.result-item-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.queue-item-size,
.result-item-size {
    font-size: 12px;
    color: var(--text-secondary);
}

.queue-item-warning {
    font-size: 12px;
    color: var(--warning-color);
    margin-top: 4px;
    font-weight: 500;
}

.queue-item-dimensions {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.queue-item-dimensions.warning {
    color: var(--warning-color);
    font-weight: 500;
}

.queue-item-format {
    font-size: 12px;
    margin-top: 4px;
    color: var(--text-secondary);
}

.queue-item-result {
    font-size: 12px;
    color: var(--success-color);
    margin-top: 4px;
    font-weight: 500;
}

.queue-item-from {
    color: var(--text-secondary);
    font-weight: normal;
    margin-left: 4px;
}

.queue-item-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.status-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.status-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--success-color);
    color: white;
    font-size: 12px;
}

.status-error {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--error-color);
    color: white;
    font-size: 12px;
}

.queue-item-actions,
.result-item-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--secondary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    font-size: 16px;
}

.btn-icon:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

.btn-icon.danger:hover {
    background: var(--error-color);
}

/* Queue Actions */
.queue-actions,
.results-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.download-buttons {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

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

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

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

.btn-secondary:hover:not(:disabled) {
    background: #7f8c8d;
    box-shadow: var(--shadow-lg);
}

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

/* Footer */
.footer {
    text-align: center;
    padding: 16px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--error-color);
    color: white;
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 300px;
    display: none;
    z-index: 999;
    animation: slideIn 0.3s ease;
}

.toast.active {
    display: block;
}

.toast.success {
    background: var(--success-color);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 12px;
        gap: 12px;
    }

    .header {
        padding: 16px 12px;
    }

    .header h1 {
        font-size: 24px;
    }

    section {
        padding: 16px;
    }

    .upload-box {
        padding: 30px 16px;
    }

    .queue-actions,
    .results-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.2s ease;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    margin-bottom: 12px;
    font-size: 18px;
}

.modal-content p {
    margin-bottom: 16px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.modal-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.btn-option {
    padding: 12px 16px;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 14px;
    color: var(--text-primary);
}

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

.btn-option-danger {
    background: rgba(243, 156, 18, 0.1);
    border-color: var(--warning-color);
    color: var(--warning-color);
}

.btn-option-danger:hover {
    background: var(--warning-color);
    border-color: var(--warning-color);
    color: white;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition);
}

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

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

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

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

.toast {
    right: 12px;
    left: 12px;
    bottom: 12px;
    max-width: none;
}
}
