/* Background Remover Styles */
:root {
    --primary-color: #266969;
    --primary-light: #4a9a9a;
    --accent-color: #0078d7;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --error-color: #dc3545;
    --text-color: #333;
    --text-muted: #666;
    --border-color: #ddd;
    --bg-light: #f8f9fa;
    --surface: #ffffff;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 8px;
}

/* Ensure proper layout for this page */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.background-remover-main {
    flex: 1; /* Take up available space */
    padding: 2rem 0 4rem 0; /* Add bottom padding to prevent footer overlap */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 3rem;
}

/* Upload Section */
.upload-section {
    margin-bottom: 3rem;
}

.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    background: var(--surface);
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: var(--bg-light);
}

.upload-area.drag-over {
    border-color: var(--accent-color);
    background: rgba(0, 120, 215, 0.05);
    transform: scale(1.02);
}

.upload-content {
    max-width: 400px;
    margin: 0 auto;
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    color: var(--primary-color);
}

.upload-icon svg {
    width: 100%;
    height: 100%;
}

.upload-area h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-color);
    font-size: 1.5rem;
}

.upload-area p {
    margin: 0.5rem 0;
    color: var(--text-muted);
}

.supported-formats {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 8px 0 4px;
    font-weight: 500;
}

.upload-limits {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 4px 0;
}

.format-note {
    color: #e74c3c;
    font-size: 0.8rem;
    margin: 4px 0 16px;
    font-style: italic;
}

.browse-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
    transition: background 0.3s ease;
}

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

/* Processing Section */
.processing-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 4rem; /* Add bottom margin for spacing */
}

.processing-container {
    max-width: 1000px;
    margin: 0 auto;
}

.image-comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: center;
    margin-bottom: 2rem;
}

.image-panel h3 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: 1.2rem;
}

.image-container {
    position: relative;
    background: var(--bg-light);
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
}

.image-container img,
.image-container canvas {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.arrow-separator {
    width: 32px;
    height: 32px;
    color: var(--primary-color);
    background: var(--bg-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
}

.processing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.processing-overlay p {
    margin-top: 1rem;
    color: var(--text-color);
    font-weight: 500;
}

/* Controls Panel */
.controls-panel {
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.control-group {
    margin-bottom: 2rem;
}

.control-group h4 {
    margin: 0 0 1rem 0;
    color: var(--text-color);
    font-size: 1.1rem;
}

.background-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.bg-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.bg-option:hover {
    border-color: var(--primary-color);
}

.bg-option.active {
    border-color: var(--accent-color);
    background: rgba(0, 120, 215, 0.1);
    color: var(--accent-color);
}

.transparent-preview {
    width: 20px;
    height: 20px;
    background: 
        linear-gradient(45deg, #ccc 25%, transparent 25%), 
        linear-gradient(-45deg, #ccc 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #ccc 75%), 
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
    border-radius: 4px;
}

.color-preview {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.quality-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.quality-controls label {
    color: var(--text-color);
    font-weight: 500;
}

.quality-controls input[type="range"] {
    flex: 1;
    max-width: 200px;
}

.quality-controls span {
    color: var(--text-muted);
    font-weight: 500;
    min-width: 20px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding-bottom: 2rem; /* Add padding to ensure space from footer */
}

.primary-btn,
.secondary-btn,
.tertiary-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

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

.primary-btn:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

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

.secondary-btn:hover {
    background: #218838;
    transform: translateY(-2px);
}

.tertiary-btn {
    background: var(--bg-light);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.tertiary-btn:hover {
    border-color: var(--primary-color);
    background: var(--surface);
}

.primary-btn svg,
.secondary-btn svg,
.tertiary-btn svg {
    width: 18px;
    height: 18px;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.loading-content {
    text-align: center;
    padding: 2rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.loading-content h3 {
    margin: 1rem 0 0.5rem 0;
    color: var(--text-color);
}

.loading-content p {
    margin: 0;
    color: var(--text-muted);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
}

.toast {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-left: 4px solid var(--primary-color);
    animation: slideIn 0.3s ease-out;
    max-width: 350px;
}

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

.toast.error {
    border-left-color: var(--error-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .image-comparison {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .arrow-separator {
        transform: rotate(90deg);
        justify-self: center;
    }
    
    .background-options {
        justify-content: center;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .primary-btn,
    .secondary-btn,
    .tertiary-btn {
        min-width: 200px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .processing-section {
        padding: 1rem;
        margin-bottom: 3rem; /* Ensure extra space on mobile */
    }
    
    .background-remover-main {
        padding-bottom: 6rem; /* Extra bottom padding on mobile */
    }
}
