/* Background Remover API - Stylesheet */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Queue Status Styles */
.queue-status {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 12px;
    margin: 15px 0;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.queue-info h4 {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.queue-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.queue-stats .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 8px;
    min-width: 80px;
}

.queue-stats .stat-label {
    font-size: 0.8rem;
    opacity: 0.9;
    margin-bottom: 2px;
}

.queue-stats .stat-value {
    font-size: 1.2rem;
    font-weight: bold;
}

.queue-message {
    font-size: 0.9rem;
    opacity: 0.9;
    font-style: italic;
}

/* Queue Processing Styles */
.queue-processing {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.queue-processing h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.job-info {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #007bff;
}

.job-info p {
    margin-bottom: 10px;
    color: #495057;
}

.job-info strong {
    color: #2c3e50;
}

#current-job-id {
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9rem;
}

#job-status {
    color: #007bff;
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    transition: width 0.3s ease;
    border-radius: 10px;
}

#job-message {
    color: #6c757d;
    font-style: italic;
    margin-top: 10px;
}

/* Queue Actions */
#queue-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

#queue-actions .btn {
    min-width: 140px;
}

/* Tab specific queue styling */
.tab[data-tab="queue"] {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.tab[data-tab="queue"]:hover {
    background: linear-gradient(135deg, #218838, #1ea085);
}

/* Optimization Options Styles */
.optimization-options {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.optimization-options h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 8px;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.option-group {
    display: flex;
    flex-direction: column;
}

.option-group label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.form-select, .form-input {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-select:focus, .form-input:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.form-range {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #dee2e6;
    outline: none;
    margin: 10px 0;
}

.form-range::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
}

.form-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
}

.quick-presets {
    border-top: 1px solid #e9ecef;
    padding-top: 15px;
    margin-top: 15px;
}

.quick-presets strong {
    color: #495057;
    font-size: 0.9rem;
}

.preset-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    margin: 5px 5px 5px 0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

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

.preset-btn:active {
    transform: translateY(0);
}

.text-muted {
    color: #6c757d;
    font-size: 0.8rem;
    margin-top: 5px;
}

.comparison-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid #007bff;
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
}

.comparison-info h5 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 1rem;
}

.comparison-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #dee2e6;
}

.stat-label {
    font-weight: 600;
    color: #495057;
}

.stat-value {
    color: #007bff;
}

.compression-good {
    color: #28a745;
    font-weight: 600;
}

.compression-medium {
    color: #ffc107;
    font-weight: 600;
}

.compression-poor {
    color: #dc3545;
    font-weight: 600;
}

@media (max-width: 768px) {
    .options-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .comparison-stats {
        grid-template-columns: 1fr;
    }

    .preset-btn {
        display: block;
        margin: 5px 0;
        width: 100%;
    }
}

html {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8f9fa;
    color: #333;
    line-height: 1.6;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    color: #6c757d;
    font-size: 1.1rem;
}

.tabs {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 2px solid #e9ecef;
}

.tab {
    flex: 1;
    padding: 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #6c757d;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab:hover {
    color: #495057;
}

.tab.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    margin: 20px 0;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
}

.upload-area:hover {
    border-color: #007bff;
    background: #f8f9ff;
}

.upload-area.dragover {
    border-color: #007bff;
    background: #e7f3ff;
}

.upload-icon {
    font-size: 3rem;
    color: #6c757d;
    margin-bottom: 15px;
}

.upload-text {
    font-size: 1.1rem;
    color: #495057;
    margin-bottom: 5px;
}

.upload-hint {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.browse-btn {
    margin-top: 15px;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 6px;
}

input[type="file"] {
    display: none;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.result {
    margin-top: 30px;
    padding: 20px;
    border-radius: 8px;
    display: none;
}

.result.show {
    display: block;
}

.result.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.result.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.result.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.image-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

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

.image-label {
    font-weight: 600;
    margin-bottom: 10px;
    color: #495057;
}

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

.loading {
    text-align: center;
    padding: 20px;
    display: none;
}

.loading.show {
    display: block;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Progress Bar Styles */
.progress-bar {
    width: 100%;
    height: 6px;
    background-color: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    border-radius: 3px;
    transition: width 0.3s ease;
    animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Center align success message */
.result h3 {
    text-align: center;
    margin-bottom: 20px;
}

.stats {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
}

.stats p {
    margin: 5px 0;
}

.actions {
    text-align: center;
    margin-top: 20px;
}

.actions .btn {
    margin: 5px;
}

/* Base64 Input Styles */
.base64-input-container {
    margin: 20px 0;
}

.base64-input-container label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #495057;
}

.base64-input-container textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.base64-input-container textarea:focus {
    outline: none;
    border-color: #007bff;
}

.base64-input-container .hint {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #6c757d;
}

/* Footer Styles */
footer {
    margin-top: 50px;
    padding: 20px 0;
    border-top: 1px solid #e9ecef;
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
}

footer #app-version {
    font-weight: 600;
}

/* Validation Messages */
.validation-success {
    padding: 15px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    color: #155724;
    margin: 10px 0;
}

.validation-success p {
    margin: 5px 0;
}

.validation-info {
    padding: 15px;
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    color: #0c5460;
    margin: 10px 0;
}

.validation-info p {
    margin: 5px 0;
}

.validation-error {
    padding: 15px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
    margin: 10px 0;
}

.validation-error p {
    margin: 5px 0;
}

.validation-error strong {
    color: #721c24;
}

.validation-tips {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f5c6cb;
}

.validation-tips ul {
    margin: 5px 0;
    padding-left: 20px;
}

.validation-tips li {
    margin: 3px 0;
    font-size: 0.9em;
}

.loading-spinner {
    text-align: center;
    margin: 10px 0;
    font-size: 1.1em;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 2rem;
    }

    .image-comparison {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-direction: column;
    }

    .tab {
        border-bottom: 1px solid #e9ecef;
        border-right: none;
    }

    .tab.active {
        border-bottom-color: #007bff;
        border-right: none;
    }

    /* Additional mobile improvements */
    .upload-area {
        min-height: 150px;
        padding: 30px 15px;
    }

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

    .btn {
        padding: 12px 20px;
        font-size: 1rem;
    }

    .result {
        padding: 15px;
    }

    .stats {
        font-size: 0.9rem;
    }

    /* Ensure footer stays visible */
    footer {
        position: sticky;
        bottom: 0;
        background: rgba(248, 249, 250, 0.95);
        backdrop-filter: blur(10px);
        padding: 15px 0;
        border-top: 1px solid #e9ecef;
        z-index: 1000;
    }
}

/* Medium screens (tablets) */
@media (max-width: 1024px) and (min-width: 769px) {
    .container {
        max-width: 95%;
        padding: 18px;
    }

    .options-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .upload-area {
        padding: 35px 25px;
    }
}

/* Large screens improvements */
@media (min-width: 1200px) {
    .container {
        max-width: 1000px;
    }

    .image-preview {
        max-height: 400px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
        width: 100%;
        margin: 5px 0;
    }

    .actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .optimization-options {
        padding: 15px;
    }

    .option-group {
        margin-bottom: 15px;
    }

    /* Footer improvements for very small screens */
    footer {
        font-size: 0.8rem;
        padding: 10px 0;
    }

    #app-info p {
        margin: 0;
        text-align: center;
    }
}