/* Hide old UI elements */
.header_bg,
#banner.heic_converter {
    display: none !important;
}

/* Modern loading popup styles */
.image-loading-box .show-message-box {
    background: hsl(240, 10%, 7%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 2.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    min-width: 320px;
}

.image-loading-box .loading-box {
    background: hsl(240, 10%, 7%);
}

.image-loading-box .loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.image-loading-box .loading-text {
    color: hsl(240, 5%, 90%);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.image-loading-box .loading-subtext {
    color: hsl(240, 4%, 65%);
    font-size: 0.875rem;
    font-weight: 400;
    margin-top: -0.75rem;
}

/* Modern gradient spinner */
.modern-spinner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, hsl(265, 100%, 61%), #ff4b8d, hsl(265, 100%, 61%));
    animation: spin 1s linear infinite;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modern-spinner::before {
    content: '';
    position: absolute;
    width: 44px;
    height: 44px;
    background: hsl(240, 10%, 7%);
    border-radius: 50%;
}

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

.image-loading-box .cancel-upload {
    margin-top: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: hsl(240, 5%, 90%);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.image-loading-box .cancel-upload:hover {
    background: rgba(255, 255, 255, 0.2);
}

.image-loading-box .error-text,
.image-loading-box .warning-text,
.image-loading-box .alert-text {
    color: hsl(240, 5%, 90%);
    margin: 1rem 0;
    font-size: 1rem;
}

.image-loading-box .button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.image-loading-box .button-group .confirm,
.image-loading-box .button-group .cancel {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    font-weight: 500;
}

.image-loading-box .button-group .confirm {
    background: linear-gradient(90deg, hsl(265, 100%, 61%) 0%, #ff4b8d 100%);
    color: white;
}

.image-loading-box .button-group .confirm:hover {
    opacity: 0.9;
}

.image-loading-box .button-group .cancel {
    background: rgba(255, 255, 255, 0.1);
    color: hsl(240, 5%, 90%);
}

.image-loading-box .button-group .cancel:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Ensure the processing UI is on top */
.image-loading-box {
    z-index: 9999;
}

/* Ensure mobile save image is properly styled */
.mobile-save-image {
    background: hsl(240, 10%, 7%);
}

/* Style the feedback form to match new design */
.feedback {
    background: hsl(240, 10%, 7%) !important;
    background-color: hsl(240, 10%, 7%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
}

.feedback_container {
    color: hsl(240, 5%, 90%);
}

.feedback input[type="email"],
.feedback textarea {
    background: hsl(240, 14%, 5%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: hsl(240, 5%, 90%);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.feedback input[type="submit"] {
    background: linear-gradient(90deg, hsl(265, 100%, 61%) 0%, #ff4b8d 100%);
    color: white;
    font-weight: bold;
    padding: 1rem 2.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: opacity 0.3s;
}

.feedback input[type="submit"]:hover {
    opacity: 0.9;
}

/* Ensure masks match the dark theme */
.mask,
.alert-mask,
.feedback-mask {
    background: rgba(0, 0, 0, 0.8);
}

/* Override all white backgrounds in loading popups */
.image-loading-box,
.show-message-box,
.load-error-box,
.load-warning-box,
.load-warning-boxx,
.oversize-box,
.load-alert-box,
.loading-box,
.loading-box-b {
    background: hsl(240, 10%, 7%) !important;
    background-color: hsl(240, 10%, 7%) !important;
}

/* Override all dark text to light text in popups */
.show-message-box .text,
.show-message-box p,
.loading-box .loading-text,
.loading-box-b .loading-b-text,
.loading-text,
.warning-text,
.error-text,
.alert-text {
    color: hsl(240, 5%, 90%) !important;
}

/* Override button backgrounds */
.loading-box-b .button-group div {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: hsl(240, 5%, 90%) !important;
}

/* Override alert/feedback modal backgrounds */
.alert-modal-box {
    background-color: hsl(240, 10%, 7%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Override any nested light backgrounds */
.show-message-box .text .max_overresolution div {
    background: rgba(255, 255, 255, 0.05) !important;
    color: hsl(240, 5%, 90%) !important;
}

/* Preview Popup Modal Styles */
.preview-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.preview-popup-overlay.active {
    display: flex;
}

.preview-popup-content {
    background: hsl(240, 10%, 7%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.preview-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.preview-popup-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(90deg, hsl(265, 100%, 61%) 0%, #ff4b8d 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.preview-popup-close {
    background: none;
    border: none;
    color: hsl(240, 5%, 90%);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: background 0.3s;
}

.preview-popup-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.preview-comparison-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    padding: 2rem;
    align-items: center;
}

.preview-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.preview-label {
    font-size: 1rem;
    font-weight: 600;
    color: hsl(240, 4%, 65%);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.preview-original-img,
.preview-enhanced-img {
    max-width: 100%;
    max-height: 400px;
    width: auto;
    height: auto;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    object-fit: contain;
}

.preview-resolution {
    font-size: 0.875rem;
    color: hsl(240, 4%, 65%);
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
}

.preview-divider {
    width: 2px;
    height: 300px;
    background: linear-gradient(180deg, transparent, hsl(265, 100%, 61%), #ff4b8d, transparent);
}

.preview-popup-actions {
    display: flex;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    justify-content: flex-end;
}

.preview-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border-radius: 0.5rem;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Space Grotesk', sans-serif;
}

.preview-btn-primary {
    background: linear-gradient(90deg, hsl(265, 100%, 61%) 0%, #ff4b8d 100%);
    color: white;
}

.preview-btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.preview-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: hsl(240, 5%, 90%);
}

.preview-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.preview-btn .material-symbols-outlined {
    font-size: 1.25rem;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .preview-comparison-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .preview-divider {
        display: none;
    }
    
    .preview-popup-actions {
        flex-direction: column;
    }
    
    .preview-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Upscale Option Sliders */
.slider-option {
    margin-top: 1.5rem;
}

.upscale-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upscale-slider:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Webkit browsers (Chrome, Safari) */
.upscale-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, hsl(265, 100%, 61%), #ff4b8d);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(165, 60, 255, 0.4);
}

.upscale-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(165, 60, 255, 0.6);
}

/* Firefox */
.upscale-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, hsl(265, 100%, 61%), #ff4b8d);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(165, 60, 255, 0.4);
}

.upscale-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(165, 60, 255, 0.6);
}

/* Track fill effect for webkit */
.upscale-slider::-webkit-slider-runnable-track {
    background: linear-gradient(
        to right,
        hsl(265, 100%, 61%) 0%,
        hsl(265, 100%, 61%) var(--slider-percent, 50%),
        rgba(255, 255, 255, 0.1) var(--slider-percent, 50%)
    );
    height: 6px;
    border-radius: 3px;
}

/* Track fill effect for Firefox */
.upscale-slider::-moz-range-track {
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
    border-radius: 3px;
}

.upscale-slider::-moz-range-progress {
    background: linear-gradient(90deg, hsl(265, 100%, 61%), #ff4b8d);
    height: 6px;
    border-radius: 3px;
}
