/**
 * Frontend Styles
 *
 * @package EXBAC
 * @since   1.0.0
 */

/*	Defensive box-sizing reset */

.exbac-wrapper,
.exbac-wrapper *,
.exbac-wrapper *::before,
.exbac-wrapper *::after {
    box-sizing: border-box;
}

/* Defensive Image Shield */

.exbac-wrapper img {
    max-width: none !important;
    min-width: 100% !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    object-fit: cover !important;
    pointer-events: none;
}

/* 1. Base Wrapper */

.exbac-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    display: flex;
    user-select: none;
    margin: 0 auto;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.exbac-wrapper[data-orientation="horizontal"] .exbac-slider-handle {
    touch-action: pan-y;
}

.exbac-wrapper[data-orientation="vertical"] .exbac-slider-handle {
    touch-action: pan-x;
}

/* 2. Image Layers (Horizontal & Vertical Support) */

.exbac-wrapper .exbac-img-before {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    clip-path: polygon(0 0, var(--position) 0, var(--position) 100%, 0 100%);
}

.exbac-wrapper[data-orientation="vertical"] .exbac-img-before {
    clip-path: polygon(0 0, 100% 0, 100% var(--position), 0 var(--position));
}

/* 3. Typography & Labels */

.exbac-wrapper .exbac-label {
    position: absolute;
    padding: 5px 12px;
    background: #000000;
    color: #ffffff;
    font-size: var(--exbac-font-size, 14px);
    line-height: 1.4;
    border-radius: 3px;
    z-index: 4;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    margin: 15px;
}

/* Background Modifiers */
.exbac-wrapper[data-bg-style="semi"] .exbac-label {
    background: rgba(0, 0, 0, 0.6);
}

.exbac-wrapper[data-bg-style="glass"] .exbac-label {
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Visibility Control */
.exbac-wrapper[data-visibility="always"] .exbac-label,
.exbac-wrapper:hover .exbac-label {
    opacity: 1;
}

/* Horizontal Labels */
.exbac-wrapper[data-orientation="horizontal"] .exbac-label-before {
    left: 0;
}
.exbac-wrapper[data-orientation="horizontal"] .exbac-label-after {
    right: 0;
}

/* Vertical Labels */
.exbac-wrapper[data-orientation="vertical"] .exbac-label-before {
    top: 0;
}
.exbac-wrapper[data-orientation="vertical"] .exbac-label-after {
    bottom: 0;
}

.exbac-wrapper .exbac-label-hidden {
    opacity: 0 !important;
}

/* 4. Interactive Handle (Horizontal) */

.exbac-wrapper .exbac-slider-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--position);
    width: 40px;
    transform: translateX(-50%);
    z-index: 5;
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.exbac-wrapper .exbac-slider-line {
    position: absolute;
    width: 4px;
    height: 100%;
    background: #ffffff;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

/* 5. Interactive Handle (Vertical Override) */

.exbac-wrapper[data-orientation="vertical"] .exbac-slider-handle {
    top: var(--position);
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    height: 40px;
    transform: translateY(-50%);
    cursor: ns-resize;
    flex-direction: column;
}

.exbac-wrapper[data-orientation="vertical"] .exbac-slider-line {
    width: 100%;
    height: 4px;
}

/* Accessibility outline for keyboard users */
.exbac-wrapper .exbac-slider-handle:focus-visible {
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.8);
    border-radius: 4px;
}

.exbac-wrapper .exbac-slider-button {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* 6. Handle & Divider Themes (Light / Dark) */

.exbac-wrapper[data-handle-theme="dark"] .exbac-slider-line {
    background: #1d2327;
}

.exbac-wrapper[data-handle-theme="dark"] .exbac-slider-button {
    background: #1d2327;
    color: #ffffff;
}

/* 7. Handle Styles (Classic / Modern) */

/* Modern Pill Style - Horizontal */
.exbac-wrapper[data-handle-style="modern"] .exbac-slider-button {
    width: 32px;
    height: 48px;
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Modern Pill Style - Vertical */
.exbac-wrapper[data-handle-style="modern"][data-orientation="vertical"] .exbac-slider-button {
    width: 48px;
    height: 32px;
}

/* Adjusting SVG size inside the Modern Pill to look sleeker */
.exbac-wrapper[data-handle-style="modern"] .exbac-slider-button svg {
    width: 16px;
    height: 16px;
}
