/* ═══════════════════════════════════════════════════════════
   GSAP Compare Widget – Styles
   ═══════════════════════════════════════════════════════════ */

.gsap-compare-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: var(--aspect-ratio, auto);
    overflow: hidden;

    /* Domyślna pozycja suwaka */
    --pos: 50%;

    /* Zmienne wskaźnika suwaka – nadpisywane przez Elementor inline */
    --divider-color: #ffffff;
    --handle-size: 44px;
    --handle-color: #ffffff;
    --handle-icon-color: #000000;

    border-radius: 8px;
    cursor: ew-resize;
    touch-action: pan-y; /* Mobile: pionowy scroll działa, poziomy obsługujemy ręcznie */
    user-select: none;
    -webkit-user-select: none;
}

/* ── Obrazki ── */
.g-comp-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: var(--object-fit, cover);
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    z-index: 1;
}

/* ── Warstwa "Po" przycinana clip-path ── */
.g-comp-after-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip-path: polygon(0 0, var(--pos) 0, var(--pos) 100%, 0 100%);
    z-index: 2;
}

/* ── Linia podziału ── */
.g-comp-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--pos);
    width: 2px; /* domyślna – nadpisywana przez Elementor selectors */
    background: var(--divider-color);
    transform: translateX(-50%);
    /* box-shadow zarządzany przez kontrolkę Elementora "Cień pod linią" */
    pointer-events: none;
    will-change: left;
    z-index: 5;
}

/* ── Uchwyt (handle) ── */
.g-comp-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    width: var(--handle-size);
    height: var(--handle-size);
    border-radius: 50%;

    background: var(--handle-color);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;

    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

/* Delikatny efekt przy aktywnym przeciąganiu */
.gsap-compare-wrapper.is-dragging .g-comp-handle {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    transform: translate(-50%, -50%) scale(1.08);
}

/* ── Strzałki SVG ── */
.g-comp-arrow {
    width: calc(var(--handle-size) * 0.36);
    height: calc(var(--handle-size) * 0.36);
    flex-shrink: 0;
    color: var(--handle-icon-color);
    display: block;
}

/* ─── Responsywność / mobile ───────────────────────────────── */
@media (hover: none) {
    /* Na urządzeniach touch kursor ew-resize nie ma sensu */
    .gsap-compare-wrapper {
        cursor: default;
    }
}

/* ─── Etykiety Przed / Po ──────────────────────────────────── */
.g-comp-label {
    position: absolute;
    bottom: 12px;
    z-index: 10;
    pointer-events: none;

    /* Domyślne wartości – nadpisywane przez Elementor selectors */
    color: #ffffff;
    background-color: rgba(0, 0, 0, 0.35);
    border-radius: 6px;
    padding: 5px 12px;

    /* Typografia – bazowe wartości */
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;

    /* Czytelność na obrazku */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* Etykieta "Przed" – lewa strona */
.g-comp-label-before {
    left: 12px;
}

/* Etykieta "Po" – prawa strona */
.g-comp-label-after {
    right: 12px;
}