.hafbox-video-widget,
.hafbox-video-widget *,
.hafbox-video-modal,
.hafbox-video-modal * {
    box-sizing: border-box !important;
    -webkit-tap-highlight-color: transparent;
}

.hafbox-video-widget {
    position: fixed !important;
    right: 25px !important;
    bottom: 95px !important;
    width: 300px !important;
    aspect-ratio: 16 / 9;
    z-index: 999990 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible;
    background: #000;
    border-radius: 18px !important;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.hafbox-video-widget:hover {
    transform: scale(1.04);
}

.hafbox-video-widget::before,
.hafbox-video-widget::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border: 3px solid rgba(255, 255, 255, 0.75);
    border-radius: 18px;
    pointer-events: none;
    animation: hafboxPulse 2s infinite;
}

.hafbox-video-widget::after {
    animation-delay: 1s;
}

@keyframes hafboxPulse {
    from {
        transform: scale(1);
        opacity: 0.7;
    }

    to {
        transform: scale(1.12);
        opacity: 0;
    }
}

.hafbox-video-widget img,
.hafbox-video-widget video {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 18px !important;
    object-fit: cover !important;
}

.hafbox-video-widget video {
    display: none !important;
}

.hafbox-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 3;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 54px !important;
    min-width: 54px !important;
    max-width: 54px !important;
    height: 54px !important;
    min-height: 54px !important;
    max-height: 54px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #000 !important;
    background: #fff !important;
    border-radius: 50% !important;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: opacity 0.25s ease;
}

.hafbox-play-icon::after {
    content: "";
    display: block;
    width: 0;
    height: 0;
    margin-left: 4px;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-left: 15px solid currentColor;
}

.hafbox-widget-close {
    position: absolute !important;
    top: -11px !important;
    right: -11px !important;
    z-index: 5 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 28px !important;
    min-width: 28px !important;
    max-width: 28px !important;
    height: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #fff !important;
    background: #111 !important;
    border: 2px solid #fff !important;
    border-radius: 50% !important;
    outline: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    font-family: Arial, sans-serif !important;
    font-size: 18px !important;
    font-weight: bold !important;
    line-height: 1 !important;
    cursor: pointer !important;
}

.hafbox-video-modal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9999999 !important;
    display: none !important;
    align-items: center;
    justify-content: center;
    padding: 30px !important;
    background: rgba(0, 0, 0, 0.88) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.hafbox-video-modal.is-open {
    display: flex !important;
}

.hafbox-modal-content {
    position: relative !important;
    width: min(1000px, 92vw) !important;
    max-height: 85vh;
    margin: auto !important;
    aspect-ratio: 16 / 9;
}

.hafbox-modal-video {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    background: #000 !important;
    border-radius: 16px !important;
    outline: none !important;
    object-fit: contain !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.hafbox-modal-close {
    position: absolute !important;
    top: -18px !important;
    right: -18px !important;
    z-index: 10 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #000 !important;
    background: #fff !important;
    border: 0 !important;
    border-radius: 50% !important;
    outline: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    font-family: Arial, sans-serif !important;
    font-size: 28px !important;
    font-weight: 300 !important;
    line-height: 1 !important;
    cursor: pointer !important;
}

@media (max-width: 767px) {
    .hafbox-video-widget {
        right: 15px !important;
        bottom: 105px !important;
        width: 150px !important;
        border-radius: 12px !important;
    }

    .hafbox-video-widget img,
    .hafbox-video-widget video,
    .hafbox-video-widget::before,
    .hafbox-video-widget::after {
        border-radius: 12px !important;
    }

    .hafbox-play-icon {
        width: 38px !important;
        min-width: 38px !important;
        max-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
    }

    .hafbox-play-icon::after {
        margin-left: 3px;
        border-top-width: 6px;
        border-bottom-width: 6px;
        border-left-width: 11px;
    }

    .hafbox-widget-close {
        top: -9px !important;
        right: -9px !important;
        width: 25px !important;
        min-width: 25px !important;
        max-width: 25px !important;
        height: 25px !important;
        min-height: 25px !important;
        max-height: 25px !important;
        font-size: 15px !important;
    }

    .hafbox-video-modal {
        padding: 15px !important;
    }

    .hafbox-modal-content {
        width: 95vw !important;
    }

    .hafbox-modal-video {
        border-radius: 12px !important;
    }

    .hafbox-modal-close {
        top: -14px !important;
        right: -8px !important;
        width: 34px !important;
        min-width: 34px !important;
        max-width: 34px !important;
        height: 34px !important;
        min-height: 34px !important;
        max-height: 34px !important;
        font-size: 22px !important;
    }

    body.woocommerce-cart .hafbox-video-widget,
    body.woocommerce-checkout .hafbox-video-widget,
    body.woocommerce-account .hafbox-video-widget {
        display: none !important;
    }
}

.hafbox-widget-open {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: 16 / 9;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: inherit !important;
    background: #000 !important;
    cursor: pointer !important;
    overflow: hidden;
}
.hafbox-widget-open:focus-visible,
.hafbox-widget-close:focus-visible,
.hafbox-modal-close:focus-visible {
    outline: 3px solid #4ca8ff !important;
    outline-offset: 4px !important;
}
.hafbox-video-widget[hidden],
.hafbox-video-modal[hidden] { display: none !important; }
.hafbox-focus-boundary { position: absolute; width: 1px; height: 1px; overflow: hidden; }
.hafbox-widget-open img, .hafbox-widget-open video { pointer-events: none; }
.hafbox-modal-content {
    width: min(1000px, 92vw, calc((100dvh - 90px) * 16 / 9)) !important;
}
@media (max-width: 767px) {
    .hafbox-video-widget { max-width: calc(100vw - 45px) !important; }
    .hafbox-modal-content {
        width: min(95vw, calc((100dvh - 70px) * 16 / 9)) !important;
    }
}
body.woocommerce-cart .hafbox-video-widget,
body.woocommerce-checkout .hafbox-video-widget,
body.woocommerce-account .hafbox-video-widget { display: none !important; }
@media (prefers-reduced-motion: reduce) {
    .hafbox-video-widget::before,
    .hafbox-video-widget::after { animation: none !important; }
    .hafbox-video-widget,
    .hafbox-play-icon { transition: none !important; }
    .hafbox-video-widget:hover { transform: none; }
}

