/**
 * Product Visualization - Comparison Slider Styles
 * Before/After slider component
 */

/* ===== Comparison Container ===== */
.pv-comparison-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
    border-radius: var(--pv-radius);
    border: 1px solid var(--pv-border);
    touch-action: none;
    user-select: none;
    cursor: ew-resize;
    background: #f8f8f8;
}

/* ===== After Image (Base Layer) ===== */
.pv-comparison-image-after {
    display: block;
    width: 100%;
    height: auto;
}

/* ===== Before Wrapper (Clipping Layer) ===== */
.pv-comparison-before-wrapper {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 0%;
    overflow: hidden;
}

.pv-comparison-image-before {
    position: absolute;
    top: 0;
    right: 0;
    display: block;
    height: auto;
    /* Width set by JavaScript to match container width */
}

/* ===== Handle (Divider) ===== */
.pv-comparison-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 100%;
    width: 4px;
    background: var(--pv-white);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
    transform: translateX(-50%);
    z-index: 10;
    cursor: ew-resize;
}

.pv-comparison-handle::before,
.pv-comparison-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-style: solid;
}

.pv-comparison-handle::before {
    top: 50%;
    margin-top: -35px;
    border-width: 0 8px 10px 8px;
    border-color: transparent transparent var(--pv-white) transparent;
    filter: drop-shadow(0 -2px 3px rgba(0, 0, 0, 0.2));
}

.pv-comparison-handle::after {
    top: 50%;
    margin-top: 25px;
    border-width: 10px 8px 0 8px;
    border-color: var(--pv-white) transparent transparent transparent;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

/* ===== Handle Circle ===== */
.pv-comparison-handle-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: var(--pv-white);
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: ew-resize;
}

.pv-comparison-handle-circle i {
    font-size: 1.2rem;
    color: var(--pv-gray-600);
}

/* ===== Labels ===== */
.pv-comparison-label {
    position: absolute;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    color: var(--pv-white);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    z-index: 5;
    pointer-events: none;
    white-space: nowrap;
}

.pv-comparison-label-before {
    top: 12px;
    right: 12px;
}

.pv-comparison-label-after {
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, var(--pv-primary) 0%, #e01020 100%);
}

/* ===== Tooltip ===== */
.pv-comparison-tooltip {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 18px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    color: var(--pv-white);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--pv-radius-round);
    z-index: 15;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pv-comparison-tooltip.show {
    opacity: 1;
}

.pv-comparison-tooltip i {
    font-size: 1rem;
}

/* ===== Invitation Animation ===== */
@keyframes pvHandleSlideInvite {
    0% { left: 100%; }
    50% { left: 50%; }
    100% { left: 100%; }
}

@keyframes pvHandlePulse {
    0%, 100% { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); }
    50% { box-shadow: 0 2px 20px rgba(202, 0, 15, 0.5), 0 0 30px rgba(202, 0, 15, 0.3); }
}

@keyframes pvWrapperSlideInvite {
    0% { width: 0%; }
    50% { width: 50%; }
    100% { width: 0%; }
}

.pv-comparison-container.animate-invite .pv-comparison-handle {
    animation: pvHandleSlideInvite 2s ease-in-out 1;
}

.pv-comparison-container.animate-invite .pv-comparison-handle-circle {
    animation: pvHandlePulse 1s ease-in-out 2;
}

.pv-comparison-container.animate-invite .pv-comparison-before-wrapper {
    animation: pvWrapperSlideInvite 2s ease-in-out 1;
}

/* ===== No Comparison Mode ===== */
.pv-comparison-container.no-comparison {
    cursor: default;
}

.pv-comparison-container.no-comparison .pv-comparison-handle,
.pv-comparison-container.no-comparison .pv-comparison-before-wrapper,
.pv-comparison-container.no-comparison .pv-comparison-label-before,
.pv-comparison-container.no-comparison .pv-comparison-tooltip {
    display: none;
}

/* ===== Fullscreen Button (inside comparison container) ===== */
.pv-comparison-container .pv-fullscreen-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    left: auto;
    transform: none;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    gap: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto;
    opacity: 1;
}

.pv-comparison-container .pv-fullscreen-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.pv-comparison-container .pv-fullscreen-btn:active {
    transform: scale(0.98);
}

/* ===== Mobile Responsive ===== */
@media (max-width: 576px) {
    .pv-comparison-handle-circle {
        width: 38px;
        height: 38px;
    }

    .pv-comparison-handle-circle i {
        font-size: 1rem;
    }

    .pv-comparison-label {
        font-size: 0.7rem;
        padding: 5px 10px;
    }

    .pv-comparison-tooltip {
        font-size: 0.8rem;
        padding: 8px 14px;
        bottom: 15px;
    }
}
