/**
 * WooSee Frontend Styles
 * Bubble and player styles in Instagram Stories style
 */

/* ========================================
   VIDEO BUBBLE (Floating Circle)
   ======================================== */

/* ========================================
   VIDEO BUBBLE (Floating Circle)
   ======================================== */

.woosee-bubble {
    position: fixed;
    z-index: 9998;
    cursor: pointer;
    transition: transform 0.3s ease;

    /* Default Size (Mobile) */
    width: var(--woosee-bubble-size-mobile, 60px);
    height: var(--woosee-bubble-size-mobile, 60px);

    /* Initial hidden state for entry animation */
    opacity: 0;
    pointer-events: none;
    box-sizing: border-box;
    /* Added for safety */
}

/* Desktop Size */
@media (min-width: 768px) {
    .woosee-bubble {
        width: var(--woosee-bubble-size-desktop, 80px);
        height: var(--woosee-bubble-size-desktop, 80px);
    }
}

/* POSITIONING (Classes injected by PHP) */
/* Default: Bottom Right */
.woosee-pos-bottom-right {
    bottom: 30px;
    right: 30px;
}

.woosee-pos-bottom-left {
    bottom: 30px;
    left: 30px;
}

.woosee-pos-top-right {
    top: 30px;
    right: 30px;
}

.woosee-pos-top-left {
    top: 30px;
    left: 30px;
}

/* Mobile Adjustments for Position */
@media (max-width: 768px) {
    .woosee-pos-bottom-right {
        bottom: 20px;
        right: 20px;
    }

    .woosee-pos-bottom-left {
        bottom: 20px;
        left: 20px;
    }

    .woosee-pos-top-right {
        top: 20px;
        right: 20px;
    }

    .woosee-pos-top-left {
        top: 20px;
        left: 20px;
    }
}


/* Entry Animation Classes */
.woosee-bubble.woosee-entry-slide-up {
    animation: wooseeSlideUp var(--woosee-entry-dur, 1s) ease forwards;
}

.woosee-bubble.woosee-entry-fade-in {
    animation: wooseeFadeIn var(--woosee-entry-dur, 1s) ease forwards;
}

.woosee-bubble.woosee-entry-zoom-in {
    animation: wooseeZoomIn var(--woosee-entry-dur, 1s) cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.woosee-bubble.woosee-entry-bounce-in {
    animation: wooseeBounceIn var(--woosee-entry-dur, 1s) cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

/* If 'none', just appears */
.woosee-bubble.woosee-visible.woosee-entry-none {
    opacity: 1;
    pointer-events: auto;
}

/* Generic visible state after animation */
.woosee-bubble.woosee-visible {
    pointer-events: auto;
}


.woosee-bubble:hover {
    transform: scale(1.1);
}

.woosee-bubble-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Continuous Animations (applied to inner) */
.woosee-bubble-inner.woosee-loop-pulse {
    animation: wooseePulse var(--woosee-loop-speed, 2s) ease-in-out infinite;
}

.woosee-bubble-inner.woosee-loop-bounce {
    animation: wooseeBounce var(--woosee-loop-speed, 2s) infinite;
}

.woosee-bubble-inner.woosee-loop-shake {
    animation: wooseeShake var(--woosee-loop-speed, 2s) ease-in-out infinite;
}

.woosee-bubble-inner.woosee-loop-rotate {
    animation: wooseeRotate var(--woosee-loop-speed, 3s) linear infinite;
}

/* Call to Action Tooltip */
.woosee-bubble-cta {
    position: absolute;
    width: max-content;
    max-width: 200px;
    background: #fff;
    color: #333;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    white-space: normal;
    z-index: 99999;
}

/* Smart Message Positioning (Always inwards) */

/* Right (Bottom-Right, Top-Right) -> Message to the Left */
.woosee-pos-bottom-right .woosee-bubble-cta,
.woosee-pos-top-right .woosee-bubble-cta {
    right: 100%;
    /* Touches the left of the bubble */
    margin-right: 15px;
    /* Gap */
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    /* Initial to animate */
}

.woosee-pos-bottom-right .woosee-bubble-cta.woosee-cta-visible,
.woosee-pos-top-right .woosee-bubble-cta.woosee-cta-visible {
    opacity: 1 !important;
    transform: translateY(-50%) translateX(0) !important;
}

/* Left (Bottom-Left, Top-Left) -> Message to the Right */
.woosee-pos-bottom-left .woosee-bubble-cta,
.woosee-pos-top-left .woosee-bubble-cta {
    left: 100%;
    /* Touches the right of the bubble */
    margin-left: 15px;
    /* Gap */
    top: 50%;
    transform: translateY(-50%) translateX(-10px);
    /* Initial to animate */
}

.woosee-pos-bottom-left .woosee-bubble-cta.woosee-cta-visible,
.woosee-pos-top-left .woosee-bubble-cta.woosee-cta-visible {
    opacity: 1 !important;
    transform: translateY(-50%) translateX(0) !important;
}


/* CTA Arrows (Arrow points to the bubble) */
.woosee-bubble-cta::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    top: 50%;
    margin-top: -5px;
    transform: rotate(45deg);
}

/* Arrow adjustment for Right (Message on Left) */
.woosee-pos-bottom-right .woosee-bubble-cta::after,
.woosee-pos-top-right .woosee-bubble-cta::after {
    right: -5px;
    /* Arrow on the right of the tooltip */
}

/* Arrow adjustment for Left (Message on Right) */
.woosee-pos-bottom-left .woosee-bubble-cta::after,
.woosee-pos-top-left .woosee-bubble-cta::after {
    left: -5px;
    /* Arrow on the left of the tooltip */
}

/* Pop entry animation */
/* KEYFRAMES */

/* Entry: Slide Up */
@keyframes wooseeSlideUp {
    0% {
        opacity: 0;
        transform: translateY(50px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Entry: Fade In */
@keyframes wooseeFadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

/* Entry: Zoom In */
@keyframes wooseeZoomIn {
    0% {
        opacity: 0;
        transform: scale(0);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Entry: Bounce In */
@keyframes wooseeBounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    20% {
        transform: scale(1.1);
    }

    40% {
        transform: scale(0.9);
    }

    60% {
        opacity: 1;
        transform: scale(1.03);
    }

    80% {
        transform: scale(0.97);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Loop: Pulse */
@keyframes wooseePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Loop: Bounce */
@keyframes wooseeBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Loop: Shake */
@keyframes wooseeShake {

    0%,
    100% {
        transform: rotate(0deg);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: rotate(-3deg);
    }

    20%,
    40%,
    60%,
    80% {
        transform: rotate(3deg);
    }
}

/* Loop: Rotate */
@keyframes wooseeRotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ========================================
   MODAL (Dark background)
   ======================================== */

.woosee-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 99999 !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
}

.woosee-modal.active {
    display: flex;
    animation: wooseeFadeIn 0.3s ease;
}

.woosee-modal.closing {
    animation: wooseeFadeOut 0.3s ease;
}

@keyframes wooseeFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes wooseeFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Overlay (dark background with opacity) */
.woosee-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(20, 20, 20, 0.85);
    backdrop-filter: blur(8px);
}

/* Modal content */
.woosee-modal-content {
    position: inherit !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 100000 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 24px !important;
    box-sizing: border-box !important;
    flex-direction: row !important;
    margin: 0 !important;
}

/* ========================================
   VIDEO PLAYER (Stories Style 9:16)
   ======================================== */

.woosee-video-container {
    position: relative !important;
    width: 100% !important;
    max-width: calc((100vh - 48px) * 9 / 16) !important;
    height: 100% !important;
    margin: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.woosee-player-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.woosee-player {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ========================================
   CONTROLES (Top Right Grouped)
   ======================================== */

.woosee-controls-wrapper {
    position: absolute !important;
    top: 34px !important;
    right: 20px !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 100002 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 15px !important;
}

.woosee-playback-group {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    background: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(10px) !important;
    padding: 6px 10px !important;
    border-radius: 20px !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

.woosee-control-btn {
    box-sizing: border-box !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    color: #fff !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 2px !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    min-width: unset !important;
    min-height: unset !important;
    max-width: unset !important;
    max-height: unset !important;
    line-height: 1 !important;
    transition: transform 0.2s !important;
    flex-shrink: 0 !important;
}

.woosee-control-btn::after,
.woosee-control-btn::before,
.woosee-close-btn::after,
.woosee-close-btn::before,
.woosee-nav-arrow::after,
.woosee-nav-arrow::before {
    display: none !important;
    content: none !important;
}

.woosee-control-btn svg,
.woosee-close-btn svg,
.woosee-nav-arrow svg {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: 20px !important;
    height: 20px !important;
}

.woosee-close-btn svg {
    width: 24px !important;
    height: 24px !important;
}

.woosee-control-btn:hover {
    transform: scale(1.1) !important;
    opacity: 0.8 !important;
    background: transparent !important;
}

.woosee-close-btn {
    box-sizing: border-box !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: rgba(0, 0, 0, 0.4) !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    border-radius: 50% !important;
    color: #fff !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    backdrop-filter: blur(10px) !important;
    transition: all 0.3s ease !important;
    flex-shrink: 0 !important;
}

.woosee-close-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: rotate(90deg) !important;
}

/* ========================================
   SEGMENTED PROGRESS BAR
   ======================================== */

.woosee-stories-progress {
    position: absolute !important;
    top: 16px !important;
    /* Above controls */
    left: 20px !important;
    right: 20px !important;
    bottom: auto !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 10px !important;
    z-index: 100002 !important;
    height: 4px !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

.woosee-story-bar {
    flex: 1;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    height: 100%;
}

.woosee-story-fill {
    height: 100%;
    background: #fff;
    width: 0%;
    /* CSS transition removed because JavaScript fires 60FPS updates via RequestAnimationFrame */
}

.woosee-story-bar.active .woosee-story-fill {
    /* Width controlled via JS */
}

.woosee-story-bar.viewed .woosee-story-fill {
    width: 100%;
}

/* ========================================
   NAVIGATION ZONES & ARROWS
   ======================================== */

.woosee-nav-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 100001;
    /* Above video, below controls */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.woosee-nav-left {
    left: 0;
    width: 30%;
    /* cursor: w-resize; OPCIONAL */
}

.woosee-nav-right {
    right: 0;
    width: 30%;
    /* cursor: e-resize; OPCIONAL */
}

.woosee-nav-center {
    left: 30%;
    width: 40%;
}

/* Arrow Styles (Desktop Only) */
.woosee-nav-arrow {
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s, background 0.3s;
    pointer-events: none;
    /* Allows click to pass through to the zone */
}

/* Show arrows on hover of the zone */
.woosee-nav-left:hover .woosee-nav-arrow,
.woosee-nav-right:hover .woosee-nav-arrow {
    opacity: 1;
}

/* Position arrows closer to video edge with padding as requested */
.woosee-nav-left .woosee-nav-arrow {
    margin-right: auto;
    margin-left: 20px;
}

.woosee-nav-right .woosee-nav-arrow {
    margin-left: auto;
    margin-right: 20px;
}

/* ========================================
   RESPONSIVENESS
   ======================================== */

@media (max-width: 768px) {
    .woosee-bubble {
        bottom: 20px;
        right: 20px;
    }

    /* Let mobile styles inherit standard container dimensions */

    .woosee-controls-wrapper {
        top: 20px !important;
        right: 16px !important;
    }

    .woosee-stories-progress {
        top: 10px !important;
        left: 10px !important;
        right: 10px !important;
    }

    .woosee-modal-content {
        padding: 16px !important;
    }

    .woosee-video-container {
        max-width: calc((100vh - 32px) * 9 / 16) !important;
    }

    /* Hide arrows on mobile */
    .woosee-nav-arrow {
        display: none !important;
    }
}