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

/* -------------------------------------------------------------------------- */
/*	Defensive box-sizing reset
/* -------------------------------------------------------------------------- */

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

/* -------------------------------------------------------------------------- */
/* Defensive Image Shield
/* -------------------------------------------------------------------------- */

.mbac-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
/* -------------------------------------------------------------------------- */

.mbac-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);
}

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

.mbac-wrapper .mbac-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%);
}

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

/* -------------------------------------------------------------------------- */
/* 3. Typography & Labels
/* -------------------------------------------------------------------------- */

.mbac-wrapper .mbac-label {
    position: absolute;
    padding: 5px 12px;
    background: #000000; /* Solid default */
    color: #ffffff;
    font-size: var(--mbac-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 */
.mbac-wrapper[data-bg-style="semi"] .mbac-label {
    background: rgba(0, 0, 0, 0.6);
}

.mbac-wrapper[data-bg-style="glass"] .mbac-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 */
.mbac-wrapper[data-visibility="always"] .mbac-label,
.mbac-wrapper:hover .mbac-label {
    opacity: 1;
}

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

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

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

/* -------------------------------------------------------------------------- */
/* 4. Interactive Handle (Horizontal)
/* -------------------------------------------------------------------------- */

.mbac-wrapper .mbac-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;
}

.mbac-wrapper .mbac-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)
/* -------------------------------------------------------------------------- */

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

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

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

.mbac-wrapper .mbac-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);
}
