/* ═══════════════════════════════════════════
   TISKON Image Compare — Frontend Styles
   ═══════════════════════════════════════════ */

.tic-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    background: transparent;
    line-height: 0;
    /* Prevent flex/grid parents from collapsing the container */
    min-height: 0;
    flex-shrink: 0;
}

/* ─── Elementor wrapper overrides ─── */
/* Elementor's flex wrapper can constrain height — force it open */
.elementor-widget-tic_image_compare .elementor-widget-container {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    min-height: 0 !important;
}

/* ─── Images ─── */

/* After image sits in normal flow — drives container height */
.tic-img.tic-after {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    pointer-events: none;
}

/* Before wrapper overlays exactly on top */
.tic-before-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 2;
}

.tic-before-wrapper .tic-img {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Horizontal clip (default) */
.tic-container[data-tic] .tic-before-wrapper {
    clip-path: inset(0 50% 0 0);
}

/* ─── Fixed height override (Elementor height control or shortcode) ─── */
.tic-container.tic-fixed-height .tic-img.tic-after {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    object-position: center;
}

.tic-container.tic-fixed-height .tic-before-wrapper .tic-img {
    object-fit: cover;
    object-position: center;
}

/* ─── Overlay ─── */
.tic-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.tic-overlay--after {
    z-index: 1;
    background: rgba(0,0,0,0.04);
}

.tic-overlay--before {
    background: rgba(0,0,0,0.04);
}

/* ─── Labels ─── */
.tic-label {
    position: absolute;
    z-index: 5;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    padding: 5px 14px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    pointer-events: none;
    transition: opacity 0.3s ease;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Horizontal labels */
.tic-container .tic-label--before {
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.tic-container .tic-label--after {
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.18);
}

/* Vertical labels */
.tic-container.tic-vertical .tic-label--before {
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
}

.tic-container.tic-vertical .tic-label--after {
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    top: auto;
    right: auto;
}

/* ─── Handle ─── */
.tic-handle {
    position: absolute;
    z-index: 10;
    top: 0;
    left: 50%;
    height: 100%;
    width: 0;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    overflow: visible;
}

.tic-handle:active {
    cursor: grabbing;
}

/* Vertical handle */
.tic-container.tic-vertical .tic-handle {
    top: 50%;
    left: 0;
    width: 100%;
    height: 0;
    transform: translateY(-50%);
    flex-direction: row;
    overflow: visible;
}

/* Handle line */
.tic-handle__line {
    position: absolute;
    background: #fff;
    box-shadow: 0 0 8px rgba(0,0,0,0.35);
    z-index: 1;
}

/* Horizontal line */
.tic-container .tic-handle__line {
    width: 3px;
    height: 100%;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* Vertical line */
.tic-container.tic-vertical .tic-handle__line {
    height: 3px;
    width: 100%;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

/* Handle knob */
.tic-handle__knob {
    position: relative;
    z-index: 2;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.tic-handle__knob:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    transform: scale(1.05);
}

/* Arrow color — default */
.tic-handle__knob svg path {
    stroke: #333;
}

/* Minimal style */
.tic-handle__knob--minimal {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    background: rgba(255,255,255,0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.tic-handle__dot {
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #aaa;
}

/* Custom handle image */
.tic-handle__custom-img {
    display: block;
    width: 70%;
    height: 70%;
    object-fit: contain;
    object-position: center;
    pointer-events: none;
    border-radius: 0;
}

/* ─── Labels on Hover ─── */
.tic-container.tic-labels-hover .tic-label {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tic-container.tic-labels-hover.tic-labels-visible .tic-label {
    opacity: 1;
}

/* ─── Elementor Editor Preview ─── */
/* Prevents collapsed widget in editor while images load */
.elementor-editor-active .tic-container {
    min-height: 300px;
}
.elementor-editor-active .tic-container .tic-img.tic-after {
    min-height: 300px;
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
    .tic-label {
        font-size: 10px;
        padding: 4px 10px;
    }

    .tic-handle__knob {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    .tic-handle__knob--minimal {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
    }

    .tic-handle__knob svg {
        width: 14px;
        height: 14px;
    }
}
