/* Custom Styles for ComfyUI Image Upscale */

/* API Status Indicator */
.status-dot {
    position: relative;
    display: inline-flex;
    width: 10px;
    height: 10px;
    border-radius: 9999px;
}

.status-dot::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 9999px;
    animation: status-ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
    opacity: 0.75;
}

@keyframes status-ping {
    75%, 100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

.status-online {
    background-color: #10b981; /* emerald-500 */
}
.status-online::after {
    background-color: #10b981;
}

.status-offline {
    background-color: #ef4444; /* red-500 */
}
.status-offline::after {
    background-color: #ef4444;
}

.status-checking {
    background-color: #f59e0b; /* amber-500 */
}
.status-checking::after {
    background-color: #f59e0b;
}

/* Image Comparison Slider (Modern clip-path approach) */
.comparison-slider-container {
    position: relative;
    width: 100%;
    height: 380px;
    border-radius: 1rem;
    overflow: hidden;
    background-color: #0a0a0a; /* Dark background to contrast photos */
    border: 1px solid rgba(16, 185, 129, 0.15); /* Subtle emerald border */
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
    user-select: none;
    --position: 50%;
}

.comparison-slider-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.comparison-slider-container .image-before {
    z-index: 1;
}

.comparison-slider-container .image-after {
    z-index: 2;
    /* Only display from the division point (--position) to 100% (right side) */
    clip-path: polygon(var(--position) 0%, 100% 0%, 100% 100%, var(--position) 100%);
}

/* Slider Handle & Divider Line */
.slider-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #10b981; /* emerald-500 line */
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    left: var(--position);
    z-index: 3;
    pointer-events: none;
}

.slider-handle {
    position: absolute;
    top: 50%;
    left: var(--position);
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #10b981;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), 0 0 0 4px rgba(16, 185, 129, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: ew-resize;
    z-index: 4;
    transition: background-color 0.2s, transform 0.2s;
    touch-action: none; /* Prevents scrolling while dragging on mobile */
}

.slider-handle:hover, .slider-handle:active {
    background-color: #059669; /* emerald-600 */
    transform: translate(-50%, -50%) scale(1.08);
}

.slider-handle svg {
    color: #ffffff;
    width: 18px;
    height: 18px;
}

/* Labels for Before / After */
.slider-label {
    position: absolute;
    bottom: 12px;
    padding: 4px 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    z-index: 5;
    pointer-events: none;
}

.slider-label-before {
    left: 12px;
}

.slider-label-after {
    right: 12px;
}

/* Progress bar fill gradient */
.progress-bar-fill-green {
    background: linear-gradient(90deg, #34d399 0%, #10b981 100%);
    transition: width 0.4s ease-out;
}

/* Pulsing effect during execution */
.executing-glow {
    animation: executing-pulse 2s infinite ease-in-out;
}

@keyframes executing-pulse {
    0%, 100% {
        border-color: rgba(16, 185, 129, 0.2);
        box-shadow: 0 8px 30px rgba(16, 185, 129, 0.02);
    }
    50% {
        border-color: rgba(16, 185, 129, 0.5);
        box-shadow: 0 8px 30px rgba(16, 185, 129, 0.12);
    }
}

/* Custom Red Cancel Button background (safeguard against static tailwind purge) */
.btn-cancel {
    background-color: #ef4444 !important; /* red-500 */
    color: #ffffff !important;
}

.btn-cancel:hover {
    background-color: #dc2626 !important; /* red-600 */
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.3), 0 4px 6px -2px rgba(239, 68, 68, 0.05) !important;
}

/* Fullscreen Modal Native Positioning (safeguard against static tailwind purge of 'fixed', 'inset-0', 'z-[100]') */
#comparisonModal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important; /* Forces layout overlap on top of navigation */
    background-color: rgba(10, 10, 10, 0.96) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    display: none; /* Controlled dynamically by Javascript click actions */
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 24px;
    box-sizing: border-box;
}

/* Close button native positioning top right */
#closeModalBtn {
    position: absolute !important;
    top: 24px !important;
    right: 24px !important;
    z-index: 100000 !important;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #ffffff;
    transition: color 0.2s, background-color 0.2s;
    padding: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#closeModalBtn:hover {
    color: #10b981 !important; /* emerald-500 */
    background-color: rgba(255, 255, 255, 0.1);
}

/* Modal Content Box wrapper structure */
.modal-content-box {
    max-width: 95vw !important; /* Allow the content box to expand up to 95% of viewport width */
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    box-sizing: border-box;
}

/* Modal comparison slider size adjustment override (really large, space-filling layout) */
#comparisonModal .comparison-slider-container {
    height: 80vh !important; /* Spans 80% of window height */
    max-height: 85vh !important;
    width: 90vw !important; /* Spans 90% of window width */
    max-width: 1300px !important;
}

/* Specific styling for the modal download button so that it doesn't become overly wide */
#modalDownloadBtn {
    max-width: 320px !important;
    width: 100% !important;
}
