/* Upload Page Overlay with Sidebar */

.upload-page-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f5f5fa;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.upload-page-wrapper {
    display: flex;
    height: 100vh;
}

/* Main Content Area */
.upload-page-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f5f5fa;
    overflow-y: auto;
}

/* Header */
.upload-page-header {
    background: #eef1f5;
    border-bottom: 1px solid #e5e7eb;
    padding: 20px 30px;
}

.back-to-upload {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: #6b7280;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.back-to-upload:hover {
    color: #0061eb;
}

/* Content */
.upload-page-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* Files Grid */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.file-card {
    background: #f5f5fa;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.file-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.file-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(245, 245, 250, 0.95);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}

.file-remove:hover {
    background: #ff4444;
}

.file-remove:hover svg {
    stroke: white;
}

.file-preview {
    width: 100%;
    height: 140px;
    background: #f5f5fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.file-details {
    padding: 12px;
    background: #f5f5fa;
}

.file-name {
    font-size: 13px;
    color: #374151;
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    font-size: 12px;
    color: #9ca3af;
}

/* Add More Button */
.add-more-images {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #f5f5fa;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 180px;
}

.add-more-images:hover {
    border-color: #0061eb;
    background: #f5f5fa;
}

.add-more-images svg {
    stroke: #9ca3af;
}

.add-more-images:hover svg {
    stroke: #0061eb;
}

.add-more-images span {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
}

/* Sidebar */
.upload-sidebar {
    width: 320px;
    background: #eef1f5;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.sidebar-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.sidebar-content h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 8px;
}

.sidebar-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 30px;
    line-height: 1.5;
}

/* Compression Settings */
.compression-settings {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setting-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.compression-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s;
}

.radio-option:hover {
    border-color: #0061eb;
    background: #f5f5fa;
}

.radio-option input[type="radio"] {
    margin-top: 2px;
    cursor: pointer;
}

.radio-option input[type="radio"]:checked + .radio-text {
    color: #0061eb;
}

.radio-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.radio-text strong {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.radio-text small {
    font-size: 12px;
    color: #6b7280;
}

/* Quality Slider */
.quality-slider-container {
    margin-top: 16px;
    padding: 16px;
    background: #f5f5fa;
    border-radius: 8px;
    position: relative;
}

/* Invisible hover extensions */
.quality-slider-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: -30px; /* Extend 30px to the right */
    bottom: 0;
    width: 30px;
    pointer-events: auto;
}

.quality-slider-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -15px; /* Extend 15px to the left */
    bottom: 0;
    width: 15px;
    pointer-events: auto;
}

.quality-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    color: #374151;
}

.quality-value {
    font-weight: 600;
    color: #0061eb;
}

#overlayQualitySlider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
}

#overlayQualitySlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0061eb;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#overlayQualitySlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0061eb;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.quality-hints {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    color: #9ca3af;
}

/* Preview Section */
.preview-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    position: relative;
}

.preview-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}

.preview-thumbnail {
    background: #f5f5fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s;
}

.preview-thumbnail:hover {
    border-color: #0061eb;
}

.preview-thumbnail img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    max-height: 100px;
    object-fit: contain;
    background: #f5f5fa;
}

.preview-size {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

/* Large Preview Overlay */
.preview-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #f5f5fa;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 20px;
    z-index: 10001;
    max-width: 600px;
    max-height: 600px;
    animation: zoomIn 0.2s ease;
}

.preview-overlay.hiding {
    animation: zoomOut 0.1s ease forwards; /* Twice as fast as fade-in */
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes zoomOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
}

.preview-overlay img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    border-radius: 8px;
    background: #f5f5fa;
}

.preview-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
    font-size: 14px;
    color: #374151;
}

.preview-info span:first-child {
    font-weight: 600;
}

/* Checkbox Option */
.checkbox-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}

.checkbox-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #e5e7eb;
}

.btn-compress-primary {
    width: 100%;
    background: #0061eb;
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.2s;
}

.btn-compress-primary:hover:not(:disabled) {
    background: #0051c7;
}

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

.btn-compress-primary .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .upload-page-wrapper {
        flex-direction: column;
    }
    
    .upload-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e5e7eb;
        max-height: 50vh;
    }
    
    .files-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 15px;
    }
    
    .file-preview {
        height: 100px;
    }
    
    .upload-page-content {
        padding: 20px;
    }
    
    .sidebar-content {
        padding: 20px;
    }
}