:root {
    --primary: #1ba4c8;
    --primary-dark: #1892B2;
    --secondary: #1892B2;
    --light-bg: #F8FCFF;
    --border: #e1e5f1;
    --text: #333;
    --text-light: #666;
    --danger: #ff6b6b;
    --success: #06d6a0;
    --warning: #ffd166;
    --info: #2b2b2b;
    --info-back: #f8f9fa;
}

/* Main Container */
.container-custom {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

.container-custom p { text-align: center; }
.container-custom select { margin-bottom: 0; }
.container-custom h3, 
.container-custom h3 a { font-size: 18px !important; padding: 0px; }

/* Content Wrapper */
.content-wrapper-custom {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    height: 800px;
}

/* Left Panel */
.left-panel-custom {
    flex: 0 0 320px;
    padding: 15px;
    border-right: 1px solid var(--border);
    overflow-y: auto !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

/* Right Panel */
.right-panel-custom {
    flex: 1;
    padding: 15px;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.section-title-custom {
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title-custom .fa-icon {
    color: var(--primary);
}

/* Upload Area */
.upload-area-custom {
    border: 2px dashed var(--primary);
    border-radius: 8px;
    padding: 5px 10px;
    text-align: center;
    background-color: rgb(164 187 200 / 10%);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 5px;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.upload-area-custom:hover {
    background-color: rgb(164 187 200 / 20%);
    border-color: var(--primary-dark);
}
.upload-area-custom i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 2px;
}
.upload-area-custom h3 {
    font-size: 1rem;
    color: var(--secondary);
}
.upload-area-custom p {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 0px;
    text-align: center;
}

#fileInput {
    display: none;
}

/* Form Controls */
.form-group-custom {
    margin-bottom: 0px;
}

.form-group-custom label {
    display: block;
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

/* Hide advanced controls in easy mode */
.advanced-only {
    display: none;
}

.mode-advanced .advanced-only {
    display: block !important;
}

/* Quick Presets Selector */
.format-selector-custom {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 2px;
}

.format-option-custom {
    border: 2px solid var(--border);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.format-option-custom:hover {
    border-color: var(--primary);
}

.format-option-custom.active-custom {
    border-color: var(--primary);
    background: rgba(27, 164, 200, 0.1);
}

.format-preview-custom {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 2px;
    border-radius: 2px;
    cursor: pointer;
}

.format-preview-custom i {
    font-size: 18px;
    color: var(--primary);
    margin-bottom: 4px;
}

.format-preview-custom span {
    font-weight: 600;
    font-size: 12px;
    margin-top: 2px;
}

/* Enhancement Tools */
.compression-levels-custom {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 2px;
}

.compression-level-custom {
    padding: 8px 4px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 11px;
    text-align: center;
    position: relative;
}

.compression-level-custom:hover {
    border-color: var(--primary);
}

.compression-level-custom.active-custom {
    border-color: var(--primary);
    background: rgba(27, 164, 200, 0.1);
    font-weight: 600;
}

.compression-level-custom i {
    font-size: 16px;
    color: #919192;
}

/* Select Full */
.select-full-custom {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    font-size: 0.9rem;
}

/* ==================== */
/* SLIDER STYLING - UPDATED */
/* ==================== */

/* Slider Container - Standard */
.quality-slider-container-custom {
    margin-top: 0px;
}

.quality-header-custom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    line-height: 1;
}

.quality-value-custom {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.85rem;
}

.quality-description-custom {
    font-size: 0.8rem;
    color: var(--text-light);
}

.quality-slider-custom {
    width: 100%;
    height: 5px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--primary) 0%, var(--primary) var(--slider-percent, 50%), #e0e0e0 var(--slider-percent, 50%), #e0e0e0 100%);
    outline: none;
    border-radius: 2.5px;
    margin-bottom: 2px;
    margin-top: 0px; /* No top margin */
}

.quality-slider-custom::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: 2px solid var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ==================== */
/* ADVANCED MODE - ULTRA COMPACT SLIDERS */
/* ==================== */

.mode-advanced .quality-slider-container-custom {
    margin-bottom: -2px; /* Negative margin to reduce space between sliders */
}

.mode-advanced .quality-header-custom {
    margin-bottom: 0px; /* No gap between label and slider */
    line-height: 0; /* Tighter line height */
}

.mode-advanced .quality-value-custom {
    font-size: 0.75rem; /* Smaller value text */
    margin-top: -1px; /* Fine-tune vertical alignment */
}

.mode-advanced .quality-description-custom {
    font-size: 0.75rem; /* Smaller description text */
    margin-top: -1px; /* Fine-tune vertical alignment */
}

.mode-advanced .quality-slider-custom {
    height: 4px; /* Thinner track */
    margin-bottom: 1px; /* Less bottom margin */
    margin-top: 0px; /* No top margin */
}

.mode-advanced .quality-slider-custom::-webkit-slider-thumb {
    width: 14px; /* Slightly smaller thumb */
    height: 14px;
    border: 2px solid var(--primary);
}

/* Strength slider (main control) stays normal size even in advanced mode */
#strengthSlider.quality-slider-custom {
    height: 5px; /* Keep normal height */
}

#strengthSlider.quality-slider-custom::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
}

/* Action Buttons */
.action-buttons-custom {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}






/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/*-LOADER-------------------------------------------------------------------------------------*/


/* Loading */
.loading-custom {
    display: none;
    text-align: center;
    padding: 8px;
}

/* PREVIEW LOADER OVERLAY */
.preview-loading-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(255, 255, 255, 0.92) !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1000 !important;
    backdrop-filter: blur(3px) !important;
    margin: 0 !important;
    padding: 0 !important;
}

.preview-loading-overlay.active {
    display: flex !important;
}

/* SPINNER WRAPPER – just a container */
.spinner-wrapper {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    height: 45px !important;
    margin-bottom: 12px !important;
}

.spinner-custom {
    display: block !important;
}

/* SPINNER – animation guaranteed */
.spinner-wrapper .spinner-custom,
.preview-loading-overlay .spinner-custom {
    width: 45px !important;
    height: 45px !important;
    border: 3px solid rgba(27, 164, 200, 0.15) !important;
    border-top: 3px solid var(--primary) !important;
    border-radius: 50% !important;
    animation: spin 0.8s linear infinite !important;
    will-change: transform !important;
}

.preview-loading-overlay p {
    color: var(--secondary) !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    margin: 0 !important;
    white-space: nowrap !important;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Rest of your preview styles (unchanged) */
.preview-container-custom {
    position: relative !important;
}

.preview-container-custom.preview-loading {
    cursor: wait;
}

.preview-container-custom.preview-loading .preview-buttons-container {
    opacity: 0.5;
    pointer-events: none;
}

.preview-container-custom.preview-loading #beforeImage,
.preview-container-custom.preview-loading #afterImage,
.preview-container-custom.preview-loading #singleImage,
.preview-container-custom.preview-loading #beforeImageSplit,
.preview-container-custom.preview-loading #afterImageSplit {
    opacity: 0.3;
}





/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------*/







/* Preview Area - FIXED POSITIONING */
.preview-area-custom {
    height: 400px !important;
    min-height: 400px !important;
    max-height: 400px !important;
    border-radius: 8px;
    border: 1px solid var(--border);
    position: relative !important; /* Ensure proper positioning */
    overflow: hidden !important;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
    flex: 0 0 400px !important;
    flex-shrink: 0 !important;
    background-color: #f8f9fa;
}

/* PREVIEW CONTAINER - CRITICAL FIXES */
.preview-container-custom {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    text-align: center;
    position: relative !important; /* Ensure overlay can be positioned absolutely */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}

/* FIXED PREVIEW LOADING OVERLAY */

/* Style when preview is loading */
.preview-container-custom.preview-loading {
    cursor: wait;
}

.preview-container-custom.preview-loading .preview-buttons-container {
    opacity: 0.5;
    pointer-events: none;
}

/* Ensure images are hidden while loading */
.preview-container-custom.preview-loading #beforeImage,
.preview-container-custom.preview-loading #afterImage,
.preview-container-custom.preview-loading #singleImage,
.preview-container-custom.preview-loading #beforeImageSplit,
.preview-container-custom.preview-loading #afterImageSplit {
    opacity: 0.3;
}

.preview-placeholder-custom {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
}

.preview-placeholder-custom i {
    font-size: 3rem;
    color: #d1d9f0;
    margin-bottom: 10px;
}

.preview-placeholder-inner-custom h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}

.preview-placeholder-inner-custom p {
    font-size: 1rem;
    color: var(--text-light);
    line-height: 1.5;
    margin: 0;
}

/* Combined Info Container */
.combined-info-container-custom {
    display: none;
    position: relative;
    background: var(--info-back);
    color: white;
    padding: 2px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(2px);
    z-index: 10;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    height: 70px;
    margin: 0;
    pointer-events: none;
    border: 1px solid #e1e5f1;
}

.combined-info-container-custom.active {
    display: flex;
}

.combined-info-container-custom * {
    pointer-events: auto;
}

.info-left-custom {
    flex: 0 0 auto;
}

.info-right-custom {
    flex: 1;
    margin-left: 20px;
    min-width: 0;
    text-align: right;
}

.dimension-values-custom {
    display: flex;
    gap: 15px;
}

.dimension-item-custom {
    text-align: center;
    min-width: 60px;
}

.dimension-row-custom {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dimension-row-custom .value-custom {
    font-size: 16px;
    font-weight: 600;
    color: var(--info);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.dimension-row-custom .label-custom {
    font-size: 11px;
    color: var(--info);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.info-text-custom {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-line-custom {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--info);
    font-weight: 400;
}

/* File List Container */
.file-list-container-custom {
   flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    max-height: 350px;
    overflow: hidden;
    position: relative;
}

.file-list-header-custom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.file-list-header-custom h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--secondary);
}

.file-count-custom {
    font-size: 0.8rem;
    color: var(--text-light);
    background: white;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

/* File Actions */
.file-header-actions-custom {
    display: flex;
    align-items: center;
    gap: 8px;
}

.delete-all-btn-custom {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    padding: 0;
}

.delete-all-btn-custom:hover {
    background: #e82121;
    color: white;
    border: none;
    box-shadow: none;
}

.delete-all-btn-custom:active {
    transform: scale(0.95);
}

/* File List */
.file-list-custom {
   flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 8px;
    min-height: 150px;
    max-height: calc(5 * 58px);
}

/* Hide scrollbar when empty state is shown */
.file-list-custom:has(.empty-state-custom:only-child) {
    overflow: hidden !important;
    max-height: 200px !important;
}

/* File Item - 2 line layout */
.file-item-custom {
    display: flex;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: all 0.2s;
    cursor: pointer;
    min-height: 48px;
    height: 48px;
    box-sizing: border-box;
    position: relative;
}

.file-item-custom:last-child {
    border-bottom: none;
}

.file-item-custom:hover {
    background-color: rgba(255,255,255,0.7);
}

.file-item-custom.active-custom {
    background-color: rgba(75, 108, 183, 0.1);
    border-left: 3px solid var(--primary);
}

/* File Actions */
.file-actions-custom {
    margin-left: 8px;
    flex-shrink: 0;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.file-item-custom:hover .file-actions-custom {
    opacity: 1;
}

.file-preview-custom {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 8px;
    border: 1px solid var(--border);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-preview-custom img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.file-preview-custom .fa-icon {
    color: #d1d9f0;
    font-size: 1.1rem;
}

.file-details-custom {
    flex: 1;
    min-width: 0;
    margin-right: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.file-name-custom {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* FIXED: 2nd line with all file details */
.file-details-row-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
}

.file-size-original-custom {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.original-label {
    font-weight: 600;
    color: var(--text);
}

.cropped-label {
    font-weight: 600;
    color: var(--success);
    margin-left: 8px;
}

.file-cropped-info-custom {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.file-cropped-size {
    font-weight: 600;
    color: var(--success);
    white-space: nowrap;
    font-size: 11px;
}

.file-dimensions {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.5);
    padding: 1px 5px;
    border-radius: 8px;
    display: inline-block;
    white-space: nowrap;
    font-size: 10px;
}

/* File Actions */
.delete-file-btn-custom {
    background: none;
    color: var(--danger);
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    padding: 0;
}

.delete-file-btn-custom:hover {
    background: none;
    color: var(--danger);
    transform: scale(1.2);
    border: none;
    box-shadow: none;
}

.delete-file-btn-custom:active {
    transform: scale(0.9);
}

/* Empty State */
.empty-state-custom {
   text-align: center;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 150px;
    margin: 0;
    padding: 20px;
}

.empty-state-custom i {
    font-size: 2rem;
    color: #d1d9f0;
    margin-bottom: 8px;
}

.empty-state-custom p {
    margin: 5px 0;
    line-height: 1.4;
}

.empty-state-custom .helper-text {
    font-size: 0.85rem;
    color: var(--text-light);
    opacity: 0.7;
}

/* Crop Result Modal */
.download-modal-custom {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2001;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.download-modal-content-custom {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    min-width: 280px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
    position: relative;
    margin: 0 auto;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.download-modal-header-custom {
    padding: 10px 10px 10px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--light-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.download-modal-header-custom h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--secondary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.download-modal-close-custom {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.download-modal-close-custom:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text);
}

.download-modal-body-custom {
    padding: 10px;
}

.crop-preview-modal-custom {
    text-align: center;
    margin-bottom: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid var(--border);
    max-height: 300px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.crop-preview-modal-custom img {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.download-options-custom {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.download-option-custom {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: var(--light-bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.download-option-custom:hover {
    border-color: var(--primary);
    background: rgba(27, 164, 200, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(27, 164, 200, 0.1);
}

.download-option-icon-custom {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
}

.download-option-content-custom {
    flex: 1;
}

.download-option-title-custom {
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 5px;
    font-size: 1rem;
}

.download-option-description-custom {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.4;
}

.download-stats-custom {
    margin-top: 10px;
    padding: 10px;
    background: var(--light-bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.stats-grid-custom {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.stat-item-custom {
    text-align: center;
    padding: 2px;
}

.stat-value-custom {
    display: block;
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 3px;
}

.stat-label-custom {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Format toggle styling */
.format-toggle-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 8px;
}

/* Toggle switch styles */
.toggle-switch-custom {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.toggle-switch-custom input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider-custom {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 20px;
}

.toggle-slider-custom:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.toggle-switch-custom input:checked + .toggle-slider-custom {
    background-color: var(--primary);
}

.toggle-switch-custom input:checked + .toggle-slider-custom:before {
    transform: translateX(20px);
}

/* Format options group */
.format-options-group-custom {
    display: block;
    margin-top: 8px;
}

/* Style for quality slider */
#qualitySlider {
    width: 100%;
    height: 5px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--primary) 0%, var(--primary) var(--quality-percent, 92%), #e0e0e0 var(--quality-percent, 92%), #e0e0e0 100%);
    outline: none;
    border-radius: 2.5px;
    margin-bottom: 2px;
}

#qualitySlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: 2px solid var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#qualitySlider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: 2px solid var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.format-badge {
    font-size: 9px;
    background: var(--primary);
    color: white;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 600;
}

/* Comparison Preview Styles */
.comparison-container-custom {
    display: flex;
    width: 100%;
    height: 100%;
}

.before-container-custom,
.after-container-custom {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.before-container-custom img,
.after-container-custom img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-label-custom {
    position: absolute;
    top: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.before-container-custom .preview-label-custom {
    left: 10px;
}

.after-container-custom .preview-label-custom {
    right: 10px;
}

/* Split View Styles with Handle */
.split-container-custom {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.split-view-wrapper-custom {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#beforeImageSplit, #afterImageSplit {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.split-line-custom {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: #1ba4c8;
    cursor: col-resize;
    z-index: 10;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    transition: left 0.05s linear;
}

.split-line-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background-color: #1ba4c8;
    border-radius: 50%;
    cursor: col-resize;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border: 3px solid white;
}

.split-line-handle:before,
.split-line-handle:after {
    content: '';
    position: absolute;
    background-color: white;
    border-radius: 2px;
}

.split-line-handle:before {
    width: 12px;
    height: 2px;
    left: 50%;
    transform: translateX(-50%);
}

.split-line-handle:after {
    width: 2px;
    height: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.split-line-custom:hover .split-line-handle {
    background-color: #1493b3;
    transform: translate(-50%, -50%) scale(1.1);
}

.split-label-left-custom,
.split-label-right-custom {
    position: absolute;
    top: 10px;
    padding: 4px 12px;
    background-color: rgba(0,0,0,0.7);
    color: white;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 5;
}

.split-label-left-custom {
    left: 10px;
}

.split-label-right-custom {
    right: 10px;
}

/* Single View Styles */
.single-container-custom {
    width: 100%;
    height: 100%;
    position: relative;
}

.single-container-custom img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.single-label-custom {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}


/* Hide broken image icons */
img[src=""], img:not([src]) {
    opacity: 0;
}

/* Drag overlay for split view */
#dragOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    cursor: col-resize;
    background: transparent;
}

/* Preview Buttons Under Image */
.preview-buttons-container {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 20;
    background: rgba(0, 0, 0, 0.20);
    padding: 8px 12px;
    margin-bottom: 0px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.preview-mode-btn {
    background: rgba(0, 0, 0, 0.20);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    text-shadow: none;
}

.preview-mode-btn:hover {
    color: white;
    background: rgba(0, 0, 0, 0.50);
}

.preview-mode-btn.active {
    background: #1ba4c8;
    color: white;
    box-shadow: 0 2px 8px rgba(27, 164, 200, 0.4);
}

.preview-mode-btn i {
    font-size: 16px;
}

/* Quick update indicator */
.quick-update-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--success);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 100;
}

.quick-update-indicator.show {
    opacity: 1;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Make sure preview images update smoothly */
#afterImage, #afterImageSplit, #singleImage {
    transition: opacity 0.3s;
}

.preview-updating {
    opacity: 0.7;
}

/* Updated Preview Placeholder Styles */
#previewPlaceholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
    top: 0;
    left: 0;
    background-color: #f8f9fa;
    z-index: 5;
    text-align: center;
}

.preview-placeholder-inner-custom {
    max-width: 300px;
    padding: 20px;
}

/* Hide preview buttons when no image is loaded */
.preview-container-custom:has(#previewPlaceholder:not([style*="display: none"])) .preview-buttons-container {
    display: none;
}

/* Hide preview containers when no image is loaded */
.preview-container-custom:has(#previewPlaceholder:not([style*="display: none"])) #comparisonContainer,
.preview-container-custom:has(#previewPlaceholder:not([style*="display: none"])) #splitContainer,
.preview-container-custom:has(#previewPlaceholder:not([style*="display: none"])) #singleContainer {
    display: none !important;
}

/* Enhancement type info */
.enhancement-type-info {
    background: var(--info-back);
    border-radius: 6px;
    padding: 8px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-light);
    border-left: 3px solid var(--primary);
    display: none;
}

.enhancement-type-info.show {
    display: block;
}

/* Loading animation for file switching */
.file-item-custom.loading {
    position: relative;
    opacity: 0.7;
}

.file-item-custom.loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Magnification Styles */
.magnification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.magnification-container {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease-out;
}

.magnification-header {
    padding: 15px 20px;
    background: var(--light-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.magnification-title {
    font-weight: 600;
    color: var(--secondary);
    font-size: 1.1rem;
}

.magnification-controls {
    display: flex;
    gap: 8px;
}

.magnification-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.magnification-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.magnification-btn.close {
    background: var(--danger);
}

.magnification-btn.close:hover {
    background: #e82121;
}

.magnification-content {
    padding: 20px;
    position: relative;
    height: 500px;
    overflow: hidden;
}

.magnification-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.magnification-viewport img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.1s ease-out;
}

.magnification-lens {
    position: absolute;
    width: 150px;
    height: 150px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -50%);
}

.magnification-lens:before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(
        circle at center,
        transparent 65%,
        rgba(27, 164, 200, 0.1) 100%
    );
}

.magnification-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.grid-line {
    position: absolute;
    background: rgba(255, 255, 255, 0.3);
}

.grid-line.horizontal {
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    transform: translateY(-50%);
}

.grid-line.vertical {
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    transform: translateX(-50%);
}

.grid-center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid white;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.magnification-info {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    display: flex;
    gap: 15px;
    z-index: 20;
}

.mag-info-text {
    display: block;
    line-height: 1.4;
}





/* Ensure preview container has proper positioning */
.preview-container-custom {
    position: relative !important;
}








.preview-container-custom.magnification-active {
    cursor: crosshair;
}

.preview-container-custom.magnification-active .preview-mode-btn:not(#magnificationBtn) {
    opacity: 0.5;
    pointer-events: none;
}

/* Magnification button in preview controls */
#magnificationBtn {
    position: relative;
}

#magnificationBtn.active {
    background: var(--success);
    color: white;
}

#magnificationBtn.active:hover {
    background: #05b888;
}

/* Enhancement type info panel */
.algorithm-info-custom {
    background: var(--info-back);
    border-radius: 6px;
    padding: 10px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-light);
    border-left: 3px solid var(--primary);
}

.algorithm-info-custom strong {
    color: var(--primary);
    font-weight: 600;
}

/* Add smooth scrolling to left panel */
.left-panel-custom::-webkit-scrollbar {
    width: 4px;
}

.left-panel-custom::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.left-panel-custom::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.left-panel-custom::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Responsive */
@media (max-width: 900px) {
    .content-wrapper-custom {
        flex-direction: column;
    }
    
    .left-panel-custom {
        flex: 0 0 auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-y: visible !important;
        max-height: none;
    }
    
    .right-panel-custom {
        flex: 1;
        padding: 15px;
        overflow-y: hidden;
        display: flex;
        flex-direction: column;
        gap: 8px;
        min-height: 0;
    }
    
    .preview-area-custom {
        flex: 0 0 300px;
        max-height: 300px;
        min-height: 300px;
    }
    
    .combined-info-container-custom {
        height: 70px;
        padding: 10px;
    }
    
    .dimension-values-custom {
        gap: 10px;
    }
    
    .dimension-item-custom {
        min-width: 50px;
    }
    
    .dimension-row-custom .value-custom {
        font-size: 14px;
    }
    
    .info-line-custom {
        font-size: 11px;
    }
    
    .file-list-container-custom {
        min-height: 150px;
    }
    
    .format-selector-custom,
    .compression-levels-custom {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .file-name-custom {
        max-width: 150px;
    }
    
    .file-details-row-custom {
        font-size: 9px;
    }
    
    .stats-grid-custom {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .comparison-container-custom {
        flex-direction: column;
    }
    
    .before-container-custom,
    .after-container-custom {
        height: 50%;
    }
    
    .split-label-left-custom,
    .split-label-right-custom {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .preview-buttons-container {
        bottom: 10px;
        padding: 6px 10px;
    }
    
    .preview-mode-btn {
        width: 35px;
        height: 35px;
        padding: 6px;
    }
    
    .split-line-handle {
        width: 35px;
        height: 35px;
    }
    
    /* Magnification Responsive */
    .magnification-container {
        width: 95%;
        max-height: 80vh;
    }
    
    .magnification-content {
        height: 400px;
        padding: 15px;
    }
    
    .magnification-lens {
        width: 120px;
        height: 120px;
    }
    
    .magnification-info {
        flex-direction: column;
        gap: 5px;
        padding: 6px 10px;
    }
    
    .mag-info-text {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .compression-levels-custom {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .format-selector-custom {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .file-name-custom {
        max-width: 120px;
    }
    
    .preview-area-custom {
        flex: 0 0 250px;
        max-height: 250px;
        min-height: 250px;
    }
    
    .upload-area-custom {
        min-height: 120px;
        padding: 12px 8px;
    }
    
    .combined-info-container-custom {
        height: 70px;
        padding: 8px 10px;
    }
    
    .dimension-values-custom {
        gap: 8px;
    }
    
    .dimension-item-custom {
        min-width: 45px;
    }
    
    .dimension-row-custom .value-custom {
        font-size: 13px;
    }
    
    .dimension-row-custom .label-custom {
        font-size: 10px;
    }
    
    .info-text-custom {
        gap: 2px;
    }
    
    .info-line-custom {
        font-size: 10px;
    }
    
    .file-list-container-custom {
        min-height: 120px;
    }
    
    .file-item-custom {
        padding: 6px 4px;
        min-height: 45px;
    }
    
    .file-name-custom {
        max-width: 100px;
    }
    
    .file-details-row-custom {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .file-size-original-custom {
        flex-basis: 100%;
        margin-bottom: 2px;
    }
    
    .file-cropped-info-custom {
        margin-left: 0;
    }
    
    .action-buttons-custom {
        flex-direction: column;
    }
    
    .action-buttons-custom button {
        width: 100%;
    }
    
    .quality-header-custom {
        /*flex-direction: column;*/
        gap: 4px;
        align-items: flex-start;
    }
    
    .section-title-custom {
        font-size: 0.9rem;
    }
    
    .crop-preview-modal-custom {
        max-height: 200px;
    }
    
    .download-modal-content-custom {
        max-width: 95%;
    }
    
    .stats-grid-custom {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .preview-label-custom,
    .single-label-custom {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .preview-buttons-container {
        bottom: 8px;
        padding: 5px 8px;
    }
    
    .preview-mode-btn {
        width: 30px;
        height: 30px;
        padding: 5px;
    }
    
    .preview-mode-btn i {
        font-size: 14px;
    }
    
    .split-line-handle {
        width: 30px;
        height: 30px;
    }
    
    /* Magnification Mobile */
    .magnification-content {
        height: 300px;
        padding: 10px;
    }
    
    .magnification-lens {
        width: 100px;
        height: 100px;
    }
    
    .magnification-header {
        padding: 10px 15px;
    }
    
    .magnification-title {
        font-size: 1rem;
    }
    
    .magnification-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
}