/**
 * Product Video Spotlight — Frontend Styles
 *
 * Badge on product gallery and fullscreen video modal.
 * Responsive: desktop (badge top-right) / mobile (badge circular left).
 */

/* =============================================
   CSS Variables
   ============================================= */

:root {
    --pvs-badge-bg: #ffffff;
    --pvs-badge-color: #1a1a1a;
    --pvs-badge-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    --pvs-badge-radius: 6px;
    --pvs-modal-bg: rgba(0, 0, 0, 0.92);
    --pvs-modal-z: 999999;
    --pvs-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================
   Badge — Desktop (top-right, rectangular)
   ============================================= */

.pvs-video-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 100;
    pointer-events: auto !important;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--pvs-badge-bg);
    color: var(--pvs-badge-color);
    border-radius: var(--pvs-badge-radius);
    box-shadow: var(--pvs-badge-shadow);
    cursor: pointer;
    transition: all var(--pvs-transition);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.pvs-video-badge:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

/* Ensure badge is clickable above Swiper overlays */
.pvs-video-badge * {
    pointer-events: none;
}

.pvs-video-badge:active {
    transform: translateY(0);
}

.pvs-badge-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #1a1a1a;
    color: #fff;
    border-radius: 50%;
    flex-shrink: 0;
}

.pvs-badge-icon svg {
    width: 12px;
    height: 12px;
    margin-left: 2px;
}

.pvs-badge-text {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* =============================================
   Badge — Mobile (circular, left side)
   ============================================= */

@media (max-width: 767px) {
    .pvs-video-badge {
        right: auto;
        left: 10px;
        bottom: auto;
        top: 15px;
        transform: none;
        padding: 0;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        justify-content: center;
        gap: 0;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    }

    .pvs-video-badge:hover {
        transform: translateY(-50%) scale(1.05);
    }

    .pvs-badge-icon {
        width: 44px;
        height: 44px;
        background: var(--pvs-badge-bg);
        color: var(--pvs-badge-color);
        border-radius: 50%;
    }

    .pvs-badge-icon svg {
        width: 16px;
        height: 16px;
    }

    .pvs-badge-text {
        display: none;
    }
}

/* =============================================
   Modal — Overlay & Container
   ============================================= */

.pvs-modal {
    position: fixed;
    inset: 0;
    z-index: var(--pvs-modal-z);
    display: none;
    align-items: center;
    justify-content: center;
}

.pvs-modal.pvs-modal--open {
    display: flex;
}

.pvs-modal-overlay {
    position: absolute;
    inset: 0;
    background: var(--pvs-modal-bg);
    opacity: 0;
    transition: opacity var(--pvs-transition);
}

.pvs-modal--open .pvs-modal-overlay {
    opacity: 1;
}

.pvs-modal-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    opacity: 0;
    transform: scale(0.95);
    transition: all var(--pvs-transition);
    overflow: hidden;
    border-radius: 16px;
}

.pvs-modal--open .pvs-modal-container {
    opacity: 1;
    transform: scale(1);
}

/* Desktop: wider container */
@media (min-width: 768px) {
    .pvs-modal-container {
        max-width: 420px;
        max-height: 85vh;
    }
}

/* =============================================
   Modal — Close Button
   ============================================= */

.pvs-modal-close {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 10 !important;
    width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-width: 44px !important;
    border: none !important;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, 0.45) !important;
    color: #fff !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    text-decoration: none !important;
    gap: 0 !important;
    font-size: 0 !important;
    line-height: 1 !important;
    transition: background 0.2s ease !important;
    -webkit-tap-highlight-color: transparent !important;
    transform: none !important;
}

.pvs-modal-close:hover,
.pvs-modal-close:focus {
    background: rgba(255, 255, 255, 0.25) !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.pvs-modal-close svg {
    width: 22px !important;
    height: 22px !important;
    flex-shrink: 0;
    display: block !important;
}

/* =============================================
   Modal — Cover State (State 1)
   ============================================= */

.pvs-modal-cover {
    position: relative;
    width: 100%;
    height: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.pvs-cover-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: brightness(0.5);
    transform: scale(1.05);
}

.pvs-cover-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.2) 0%,
        rgba(0, 0, 0, 0.5) 50%,
        rgba(0, 0, 0, 0.7) 100%
    );
}

.pvs-cover-content {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 30px;
    gap: 40px;
    width: 100%;
    height: 100%;
    min-height: 500px;
}

.pvs-cover-title {
    color: #ffffff;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin: 0;
    max-width: 340px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* =============================================
   Modal — Tap to Watch Button
   ============================================= */

.pvs-tap-to-watch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: transform var(--pvs-transition);
    -webkit-tap-highlight-color: transparent;
}

.pvs-tap-to-watch:hover {
    transform: scale(1.05);
}

.pvs-tap-icon {
    position: relative;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Pulse animation on the tap icon */
.pvs-tap-icon::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: pvsPulse 2s ease-in-out infinite;
}

@keyframes pvsPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

.pvs-tap-icon svg {
    width: 48px;
    height: 48px;
}

.pvs-tap-text {
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0.85;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* =============================================
   Modal — Video Player State (State 2)
   ============================================= */

.pvs-modal-player {
    position: relative;
    width: 100%;
    height: 100%;
    max-height: 90vh;
    overflow: hidden;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pvs-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Mute button — absolute bottom-right within modal */
.pvs-mute-btn {
    position: absolute !important;
    bottom: 12px !important;
    right: 12px !important;
    left: auto !important;
    top: auto !important;
    z-index: 10 !important;
    width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-width: 44px !important;
    border: none !important;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, 0.45) !important;
    color: #fff !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    text-decoration: none !important;
    gap: 0 !important;
    font-size: 0 !important;
    line-height: 1 !important;
    transition: background 0.2s ease !important;
    -webkit-tap-highlight-color: transparent !important;
    transform: none !important;
}

.pvs-mute-btn:hover,
.pvs-mute-btn:focus {
    background: rgba(255, 255, 255, 0.25) !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.pvs-mute-btn svg {
    flex-shrink: 0;
}

/* Default: show unmuted icon, hide muted icon */
.pvs-mute-btn .pvs-icon-unmuted {
    display: block !important;
}

.pvs-mute-btn .pvs-icon-muted {
    display: none !important;
}

/* When muted: swap icons */
.pvs-mute-btn.pvs-muted .pvs-icon-unmuted {
    display: none !important;
}

.pvs-mute-btn.pvs-muted .pvs-icon-muted {
    display: block !important;
}

/* =============================================
   Transition Utilities
   ============================================= */

.pvs-fade-in {
    animation: pvsFadeIn 0.4s ease forwards;
}

.pvs-fade-out {
    animation: pvsFadeOut 0.3s ease forwards;
}

@keyframes pvsFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pvsFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.96);
    }
}

/* =============================================
   Body lock when modal is open
   ============================================= */

body.pvs-modal-active {
    overflow: hidden !important;
}

/* =============================================
   High z-index overrides for Woodmart
   Ensure modal is above sticky header, etc.
   ============================================= */

.pvs-modal {
    z-index: 999999 !important;
}

/* =============================================
   Gallery parent needs relative positioning
   for badge absolute positioning
   ============================================= */

.woocommerce-product-gallery .wd-carousel-inner {
    position: relative;
}

/* Extra specificity for Woodmart gallery wrapper */
.wd-carousel-container.wd-gallery-images .wd-carousel-inner {
    position: relative;
}
