/* Comparison Slider Container */
.comparison-container {
    padding: 60px 0;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
    gap: 36px;
}

.comparison-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
    border: 1px solid #e9ecef;
    padding: 20px;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.comparison-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    border-color: rgba(227, 6, 19, 0.2);
}

.comparison-item {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    min-height: 380px;
    overflow: hidden;
    border-radius: 10px;
    cursor: grab;
    user-select: none;
    background: #1a1a2e;
    touch-action: pan-y;
}

.comparison-item.is-dragging {
    cursor: grabbing;
}

.comparison-before,
.comparison-after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.comparison-before img,
.comparison-after img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.comparison-before {
    z-index: 2;
    width: 100%;
    clip-path: inset(0 50% 0 0);
    /* Initial state: show left 50% */
}

.comparison-after {
    z-index: 1;
}

/* Labels */
.label-before,
.label-after {
    position: absolute;
    top: 18px;
    padding: 6px 14px;
    background: rgba(13, 27, 42, 0.85);
    backdrop-filter: blur(4px);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-radius: 6px;
    pointer-events: none;
    z-index: 3;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: opacity 0.3s ease;
}

.label-before {
    left: 18px;
    border-left: 3px solid var(--red);
}

.label-after {
    right: 18px;
    border-right: 3px solid #2ecc71;
}

/* Slider Handle */
.slider-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background: #ffffff;
    z-index: 4;
    transform: translateX(-50%);
    pointer-events: none;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.6), 0 0 4px rgba(255, 255, 255, 0.8);
    transition: width 0.2s ease, background 0.2s ease;
}

.comparison-item.is-dragging .slider-handle {
    width: 4px;
    background: #ffffff;
}

.slider-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 46px;
    height: 46px;
    background: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
    color: var(--navy);
    cursor: grab;
    pointer-events: auto;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

/* Pulsating Halo around slider button */
.slider-button::backdrop,
.slider-button-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: rgba(227, 6, 19, 0.35);
    z-index: -1;
    animation: handlePulse 2.2s infinite ease-out;
    pointer-events: none;
}

@keyframes handlePulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
    60% {
        transform: translate(-50%, -50%) scale(1.65);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.65);
        opacity: 0;
    }
}

.comparison-item:hover .slider-button,
.comparison-item.is-dragging .slider-button {
    transform: translate(-50%, -50%) scale(1.12);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(227, 6, 19, 0.25);
    cursor: grabbing;
}

.comparison-item.is-dragging .slider-button-pulse {
    animation: none;
    opacity: 0;
}

.slider-button::before,
.slider-button::after {
    content: '';
    border: solid var(--navy);
    border-width: 0 2.5px 2.5px 0;
    display: inline-block;
    padding: 4px;
    transition: transform 0.2s ease;
}

.slider-button::before {
    transform: rotate(135deg);
    margin-right: 3px;
}

.slider-button::after {
    transform: rotate(-45deg);
    margin-left: 3px;
}

.comparison-item:hover .slider-button::before {
    transform: rotate(135deg) translate(1px, -1px);
}

.comparison-item:hover .slider-button::after {
    transform: rotate(-45deg) translate(1px, -1px);
}

/* Floating Helper / Hint Pill */
.comparison-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(13, 27, 42, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    z-index: 5;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    transition: opacity 0.4s ease, transform 0.4s ease;
    animation: hintBounce 2.5s infinite ease-in-out;
}

.comparison-hint.hidden {
    opacity: 0 !important;
    transform: translate(-50%, 12px) !important;
    pointer-events: none !important;
}

.hint-arrow-left,
.hint-arrow-right {
    display: inline-flex;
    font-size: 1rem;
    line-height: 1;
    color: var(--red);
    font-weight: 900;
}

.hint-arrow-left {
    animation: arrowLeft 1.2s infinite alternate ease-in-out;
}

.hint-arrow-right {
    animation: arrowRight 1.2s infinite alternate ease-in-out;
}

@keyframes hintBounce {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(-4px);
    }
}

@keyframes arrowLeft {
    0% { transform: translateX(0); }
    100% { transform: translateX(-3px); }
}

@keyframes arrowRight {
    0% { transform: translateX(0); }
    100% { transform: translateX(3px); }
}

.comparison-info {
    margin-top: 18px;
}

.comparison-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 8px;
}

.comparison-desc {
    font-size: 0.95rem;
    color: var(--gray);
    line-height: 1.6;
}

@media (max-width: 900px) {
    .comparison-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }
    
    .comparison-item {
        aspect-ratio: 16 / 10;
        min-height: 320px;
    }

    .comparison-hint {
        font-size: 0.76rem;
        padding: 6px 13px;
        bottom: 14px;
    }
}

@media (max-width: 600px) {
    .comparison-item {
        aspect-ratio: 4 / 3;
        min-height: 240px;
    }
    
    .comparison-card {
        padding: 16px;
    }

    .slider-button {
        width: 40px;
        height: 40px;
    }
}