/**
 * Bozar Image Hotspot - Public/Frontend Styles
 * Large product card popup matching reference design
 */

.bih-hotspot-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0;
}

.bih-main-image {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Mobile modal (injected by JS). Hidden by default; shown via media query + .active */
.bih-modal-overlay {
    display: none;
}

/* Hotspot Marker */
.bih-spot {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 10;
    cursor: pointer;
}

.bih-spot-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    transition: all 0.3s ease;
}

.bih-spot-dot::before {
    content: '';
    width: 12px;
    height: 12px;
    background: #2d2d2d;
    border-radius: 50%;
}

.bih-spot:hover .bih-spot-dot {
    transform: scale(1.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Pulse Animation */
.bih-spot-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    animation: spotPulse 2s infinite;
}

@keyframes spotPulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.8);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

/* Product Card Popup - Matching reference design */
.bih-spot-popup {
    position: absolute;
    left: calc(100% + 16px);
    top: 50%;
    transform: translateY(-50%);
    width: 340px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.4;
}

.bih-spot.active .bih-spot-popup,
.bih-spot:hover .bih-spot-popup {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Header - Product Name */
.bih-popup-header {
    margin-bottom: 8px;
}

.bih-popup-name {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
    display: block;
    text-decoration: none;
}

/* Price */
.bih-popup-price {
    font-size: 15px;
    color: #1a1a1a;
    margin-bottom: 12px;
}

/* Description */
.bih-popup-desc {
    font-size: 13px;
    color: #666666;
    line-height: 1.5;
    margin: 0 0 16px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Footer - Button + Thumbnail */
.bih-popup-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* Add to Cart Button */
.bih-add-to-cart {
    display: inline-block;
    padding: 14px 24px;
    background: #1a1a1a;
    color: #ffffff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 0;
    transition: all 0.2s ease;
}

.bih-add-to-cart:hover {
    background: #333333;
    color: #ffffff;
}

/* Product Thumbnail */
.bih-popup-thumb {
    width: 100px;
    height: 100px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.bih-popup-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Edge detection - Show popup on left when near right edge */
.bih-spot.popup-left .bih-spot-popup {
    left: auto;
    right: calc(100% + 16px);
}

/* Bottom popup for lower positioned spots */
.bih-spot.popup-top .bih-spot-popup {
    top: auto;
    bottom: calc(100% + 16px);
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    /*
     * Mobile behaviour: show a centered modal card (like the reference screenshot).
     * We hide the inline popups on mobile and render the modal at the end of <body>
     * to avoid clipping issues with themes that use transforms/overflows.
     */
    .bih-spot-popup { display: none !important; }

    html.bih-modal-open,
    body.bih-modal-open {
        overflow: hidden;
    }

    .bih-spot-dot {
        width: 30px;
        height: 30px;
    }

    .bih-spot-dot::before {
        width: 10px;
        height: 10px;
    }

    .bih-spot-pulse {
        width: 30px;
        height: 30px;
    }

    .bih-modal-overlay {
        position: fixed;
        inset: 0;
        z-index: 99999;
        display: none;
        align-items: flex-start;
        justify-content: center;
        padding: 16px;
        padding-top: clamp(64px, 14vh, 180px);
        background: rgba(0, 0, 0, 0.12);
        box-sizing: border-box;
    }

    .bih-modal-overlay.active {
        display: flex;
    }

    .bih-modal-card {
        width: min(460px, calc(100vw - 32px));
        background: #ffffff;
        border-radius: 8px;
        box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
        overflow: hidden;
        text-align: center;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
        line-height: 1.4;
    }

    .bih-modal-media img {
        width: 100%;
        height: auto;
        display: block;
        max-height: 48vh;
        object-fit: cover;
    }

    .bih-modal-body {
        padding: 16px 18px 18px;
    }

    .bih-modal-name {
        font-size: 18px;
        font-weight: 600;
        color: #1a1a1a;
        line-height: 1.3;
        display: block;
        margin: 0 0 8px 0;
        text-decoration: none;
    }

    .bih-modal-price {
        font-size: 15px;
        color: #1a1a1a;
        margin-bottom: 12px;
    }

    .bih-modal-desc {
        font-size: 13px;
        color: #666666;
        line-height: 1.5;
        margin: 0 0 16px 0;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-align: left;
    }

    .bih-modal-actions .bih-add-to-cart {
        width: 100%;
        text-align: center;
        border-radius: 999px;
    }
}

@media (max-width: 420px) {
    .bih-modal-card {
        width: min(360px, calc(100vw - 32px));
    }
}

/* Ensure popup is above other elements */
.bih-spot:hover,
.bih-spot.active {
    z-index: 100;
}

/* Accessibility - Focus styles */
.bih-spot:focus-visible .bih-spot-dot {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
}

.bih-add-to-cart:focus-visible {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
}

/* Hover name labels like in reference */
.bih-spot-label {
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #ffffff;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
}

.bih-spot:hover .bih-spot-label {
    opacity: 1;
    visibility: visible;
}