/* ============================================
   Media Comparison Slider Component
   ============================================
   A reusable component for comparing two media
   elements (video or image) side by side with
   a draggable slider.

   Usage: Include this CSS and /js/media-compare.js
   See /js/media-compare.js for HTML structure.

   Weight Options:
   - Standard (default): Full-size handle with arrows
   - Lightweight: Thin bar with small circular handle

   To use lightweight style, add class "media-compare-light"
   to the .media-compare-container element.
   ============================================ */

/* ============================================
   Base Styles (Required)
   ============================================ */
.media-compare-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius);
    cursor: ew-resize;
}

.media-compare-container video,
.media-compare-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-compare-top {
    clip-path: inset(0 50% 0 0);
}

/* Dragging state */
.media-compare-container.is-dragging {
    cursor: grabbing;
}

.media-compare-container.is-dragging .media-compare-handle {
    cursor: grabbing;
}

/* ============================================
   Standard Weight (Default)
   Full-size handle bar with arrow indicators
   ============================================ */
.media-compare-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: #FFFFFF;
    cursor: ew-resize;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

/* Invisible wider hit area for easier clicking */
.media-compare-handle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 100%;
    cursor: ew-resize;
}

/* Handle icon - circular button with arrows */
.media-compare-handle-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: #FFFFFF;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    user-select: none;
}

/* Left arrow */
.media-compare-handle-icon::before {
    content: '';
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 8px solid var(--main-color);
    position: absolute;
    left: 8px;
}

/* Right arrow */
.media-compare-handle-icon::after {
    content: '';
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 8px solid var(--main-color);
    position: absolute;
    right: 8px;
}

/* ============================================
   Lightweight Weight
   Thin bar with small circular handle
   Add class "media-compare-light" to container
   ============================================ */
.media-compare-light .media-compare-handle {
    width: 2px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}

.media-compare-light .media-compare-handle-icon {
    width: 24px;
    height: 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Smaller arrows for lightweight */
.media-compare-light .media-compare-handle-icon::before {
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-right: 5px solid var(--main-color);
    left: 5px;
}

.media-compare-light .media-compare-handle-icon::after {
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 5px solid var(--main-color);
    right: 5px;
}

/* ============================================
   Labels (Optional)
   Text labels shown over left/right sides
   ============================================ */
.media-compare-label {
    position: absolute;
    bottom: 18px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.6);
    color: #FFFFFF;
    font-size: 14px;
    font-weight: bold;
    border-radius: var(--radius);
    z-index: 5;
    pointer-events: none;
}

.media-compare-label-left {
    left: 18px;
}

.media-compare-label-right {
    right: 18px;
}

/* Lightweight labels - smaller and more subtle */
.media-compare-light .media-compare-label {
    padding: 4px 8px;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.5);
}
