/* Image Converter 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;
}

.converter-main {
    flex: 1;
    padding: 2rem 0 4rem 0;
}

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

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

/* Format Info Section */
.format-info {
    text-align: center;
    margin-bottom: 3rem;
}

.format-badges {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.format-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* 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-muted);
    font-size: 0.9rem;
    margin: 8px 0 4px;
    font-weight: 500;
}

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

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

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

/* File Queue Section */
.file-queue-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.queue-header h3 {
    margin: 0;
    color: var(--text-color);
}

.queue-actions {
    display: flex;
    gap: 0.5rem;
}

.file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

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

.file-preview {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
    background: var(--border-color);
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.file-details {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-remove {
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-remove:hover {
    background: rgba(220, 53, 69, 0.1);
}

/* Settings Section */
.settings-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.settings-container h3 {
    margin: 0 0 1.5rem 0;
    color: var(--text-color);
}

.settings-grid {
    display: grid;
    gap: 2rem;
    margin-bottom: 2rem;
}

.setting-group {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.setting-group > label {
    display: block;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 1rem;
}

/* Format Selector */
.format-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.format-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background: var(--surface);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

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

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

/* Quality Settings */
#quality-slider {
    width: 100%;
    margin: 1rem 0;
}

.quality-presets {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--surface);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

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

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

/* Resize Options */
.resize-options {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

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

.input-group label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.input-group input[type="number"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.resize-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.size-presets {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.size-btn {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    background: var(--surface);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

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

/* Convert Actions */
.convert-actions {
    text-align: center;
}

/* Buttons */
.primary-btn,
.secondary-btn,
.tertiary-btn {
    display: inline-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);
}

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

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

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

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

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

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

.processing-container h3 {
    margin: 0 0 1.5rem 0;
    color: var(--text-color);
    text-align: center;
}

.overall-progress {
    margin-bottom: 2rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
    width: 0%;
}

.processing-list {
    display: grid;
    gap: 0.5rem;
}

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

.processing-item.success {
    border-color: var(--success-color);
    background: rgba(40, 167, 69, 0.05);
}

.processing-item.error {
    border-color: var(--error-color);
    background: rgba(220, 53, 69, 0.05);
}

.processing-item.active {
    border-color: var(--primary-color);
    background: rgba(38, 105, 105, 0.05);
}

.processing-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.processing-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-color);
}

.processing-status {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.processing-item.success .processing-status {
    color: var(--success-color);
}

.processing-item.error .processing-status {
    color: var(--error-color);
}

/* Results Section */
.results-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 4rem;
    box-shadow: var(--shadow);
}

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

.results-header h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-color);
}

.results-summary {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.download-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.results-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

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

.result-preview {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    object-fit: cover;
    background: var(--border-color);
}

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

.result-name {
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.result-details {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
}

.download-btn {
    padding: 0.25rem 0.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

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

/* Loading and Toast styles (same as background remover) */
.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;
}

.loading-content {
    text-align: center;
    padding: 2rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 300px;
}

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

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

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
    min-width: 300px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

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

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .format-selector,
    .quality-presets,
    .size-presets {
        justify-content: center;
    }
    
    .resize-inputs {
        grid-template-columns: 1fr;
    }
    
    .queue-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .queue-actions {
        justify-content: center;
    }
    
    .download-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .file-list,
    .results-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .settings-section,
    .processing-section,
    .results-section {
        padding: 1rem;
    }
    
    .converter-main {
        padding-bottom: 6rem;
    }
    
    .format-badges {
        justify-content: center;
    }
    
    .toast {
        min-width: 250px;
    }
}
