/**
 * WorldBrain México — Marketing & Conversion Toolkit Styles
 * @description Premium styles for Lightbox, Floating Bars, Gamified Wheel,
 *              Countdown Timers, Exit Intent, Page Targeting & Geolocation.
 * @version 1.0.0
 *
 * Uses existing design tokens from styles.css (--accent, --glass-bg, etc.)
 */

/* ═══════════════════════════════════════════════════════
   SHARED OVERLAY BACKDROP
   ═══════════════════════════════════════════════════════ */

.wbm-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.wbm-overlay.wbm-active {
    opacity: 1;
    visibility: visible;
}

.wbm-overlay .wbm-modal {
    transform: scale(0.85) translateY(30px);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wbm-overlay.wbm-active .wbm-modal {
    transform: scale(1) translateY(0);
}

/* ═══════════════════════════════════════════════════════
   SHARED MODAL CARD
   ═══════════════════════════════════════════════════════ */

.wbm-modal {
    position: relative;
    width: 90%;
    max-width: 520px;
    background: linear-gradient(145deg, rgba(30, 26, 58, 0.95), rgba(19, 16, 43, 0.98));
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 24px;
    padding: 40px 32px;
    text-align: center;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6),
        0 0 60px rgba(139, 92, 246, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.wbm-modal::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg,
            transparent,
            rgba(139, 92, 246, 0.06),
            transparent,
            rgba(236, 72, 153, 0.06),
            transparent);
    animation: wbm-rotate-glow 12s linear infinite;
    pointer-events: none;
}

@keyframes wbm-rotate-glow {
    to {
        transform: rotate(360deg);
    }
}

.wbm-modal>* {
    position: relative;
    z-index: 1;
}

/* Close button */
.wbm-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    line-height: 1;
}

.wbm-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* Modal typography */
.wbm-modal-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    display: block;
    filter: drop-shadow(0 4px 12px rgba(139, 92, 246, 0.4));
}

.wbm-modal h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 10px;
    line-height: 1.2;
}

.wbm-modal h2 .wbm-accent {
    background: linear-gradient(135deg, #8b5cf6, #ec4899, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.wbm-modal p {
    color: #a5b4c8;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

.wbm-modal .wbm-geo-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 9999px;
    font-size: 0.8rem;
    color: #a78bfa;
    font-weight: 600;
    margin-bottom: 16px;
}

/* CTA Button */
.wbm-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 36px;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(139, 92, 246, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.wbm-cta::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.wbm-cta:hover::before {
    transform: translateX(100%);
}

.wbm-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 32px rgba(139, 92, 246, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.wbm-cta:active {
    transform: translateY(-1px);
}

.wbm-cta-secondary {
    display: block;
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    cursor: pointer;
    background: none;
    border: none;
    font-family: 'Inter', sans-serif;
    transition: color 0.2s ease;
}

.wbm-cta-secondary:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* ═══════════════════════════════════════════════════════
   1. FLOATING BAR
   ═══════════════════════════════════════════════════════ */

.wbm-floating-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
    background: linear-gradient(135deg, #1e1a3a 0%, #13102b 50%, #1e1a3a 100%);
    border-bottom: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(139, 92, 246, 0.08);
    padding: 0;
    transform: translateY(-100%);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.wbm-floating-bar.wbm-active {
    transform: translateY(0);
}

.wbm-bar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.wbm-bar-text {
    color: #f8fafc;
    font-size: 0.92rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wbm-bar-text .wbm-bar-emoji {
    font-size: 1.1rem;
}

.wbm-bar-text strong {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.wbm-bar-cta {
    padding: 8px 22px;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
    border: none;
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
    text-decoration: none;
    white-space: nowrap;
}

.wbm-bar-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.wbm-bar-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.wbm-bar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Push navbar down when bar is visible */
.wbm-bar-active .navbar {
    transform: translateY(48px);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ═══════════════════════════════════════════════════════
   2. COUNTDOWN TIMER
   ═══════════════════════════════════════════════════════ */

.wbm-countdown {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.wbm-countdown-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.wbm-countdown-digit {
    width: 54px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0.05));
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 12px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #f8fafc;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}

.wbm-countdown-digit::after {
    content: '';
    position: absolute;
    top: 49%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(0, 0, 0, 0.2);
}

.wbm-countdown-label {
    font-size: 0.65rem;
    color: rgba(165, 180, 200, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.wbm-countdown-sep {
    font-size: 1.4rem;
    color: rgba(139, 92, 246, 0.6);
    font-weight: 700;
    align-self: flex-start;
    padding-top: 14px;
    animation: wbm-blink 1s step-end infinite;
}

@keyframes wbm-blink {
    50% {
        opacity: 0.3;
    }
}

/* ═══════════════════════════════════════════════════════
   3. GAMIFIED SPIN WHEEL
   ═══════════════════════════════════════════════════════ */

.wbm-wheel-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto 24px;
}

.wbm-wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    border: 4px solid rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.25),
        0 0 80px rgba(139, 92, 246, 0.1),
        inset 0 0 20px rgba(0, 0, 0, 0.3);
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

.wbm-wheel.wbm-spinning {
    pointer-events: none;
}

.wbm-wheel-segment {
    position: absolute;
    width: 50%;
    height: 50%;
    left: 50%;
    top: 50%;
    transform-origin: 0% 0%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 20px;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.wbm-wheel-segment span {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    transform: rotate(22.5deg);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Wheel pointer (triangle at top) */
.wbm-wheel-pointer {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-top: 26px solid #f97316;
    z-index: 2;
    filter: drop-shadow(0 4px 8px rgba(249, 115, 22, 0.5));
}

/* Center spin button */
.wbm-wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border: 3px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wbm-wheel-center:hover {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 0 6px 28px rgba(139, 92, 246, 0.65);
}

/* Wheel result card */
.wbm-wheel-result {
    display: none;
    text-align: center;
}

.wbm-wheel-result.wbm-active {
    display: block;
    animation: wbm-result-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes wbm-result-pop {
    from {
        opacity: 0;
        transform: scale(0.7);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.wbm-prize-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15), rgba(236, 72, 153, 0.15));
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-radius: 9999px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: #f97316;
    margin-bottom: 16px;
    animation: wbm-glow-pulse 2s ease-in-out infinite;
}

@keyframes wbm-glow-pulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(249, 115, 22, 0.2);
    }

    50% {
        box-shadow: 0 0 40px rgba(249, 115, 22, 0.4);
    }
}

/* ═══════════════════════════════════════════════════════
   4. EXIT INTENT SPECIFIC STYLES
   ═══════════════════════════════════════════════════════ */

.wbm-exit-modal .wbm-exit-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 9999px;
    font-size: 0.78rem;
    color: #f87171;
    font-weight: 600;
    margin-bottom: 14px;
    animation: wbm-pulse-badge 1.5s ease-in-out infinite;
}

@keyframes wbm-pulse-badge {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.04);
    }
}

/* ═══════════════════════════════════════════════════════
   5. CONFETTI / PARTICLES (for wheel win)
   ═══════════════════════════════════════════════════════ */

.wbm-confetti-container {
    position: fixed;
    inset: 0;
    z-index: 10001;
    pointer-events: none;
    overflow: hidden;
}

.wbm-confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: wbm-confetti-fall 3s ease-in forwards;
}

@keyframes wbm-confetti-fall {
    0% {
        transform: translateY(0) rotateZ(0deg) rotateX(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotateZ(720deg) rotateX(360deg);
        opacity: 0;
    }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .wbm-modal {
        max-width: 95%;
        padding: 28px 20px;
        border-radius: 20px;
    }

    .wbm-modal h2 {
        font-size: 1.4rem;
    }

    .wbm-modal p {
        font-size: 0.9rem;
    }

    .wbm-cta {
        padding: 14px 28px;
        font-size: 0.92rem;
        width: 100%;
    }

    .wbm-bar-inner {
        padding: 10px 16px;
        gap: 10px;
        flex-direction: column;
    }

    .wbm-bar-text {
        font-size: 0.82rem;
        text-align: center;
    }

    .wbm-bar-close {
        position: static;
        transform: none;
    }

    .wbm-countdown {
        gap: 6px;
    }

    .wbm-countdown-digit {
        width: 44px;
        height: 48px;
        font-size: 1.2rem;
    }

    .wbm-wheel-container {
        width: 250px;
        height: 250px;
    }

    .wbm-wheel-center {
        width: 52px;
        height: 52px;
        font-size: 0.55rem;
    }

    .wbm-floating-bar.wbm-active~.navbar,
    .wbm-bar-active .navbar {
        transform: translateY(72px);
    }
}

@media (max-width: 480px) {
    .wbm-modal {
        padding: 24px 16px;
    }

    .wbm-modal h2 {
        font-size: 1.2rem;
    }

    .wbm-wheel-container {
        width: 220px;
        height: 220px;
    }

    .wbm-countdown-digit {
        width: 38px;
        height: 42px;
        font-size: 1rem;
        border-radius: 8px;
    }
}

/* ═══════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {

    .wbm-overlay,
    .wbm-overlay .wbm-modal,
    .wbm-floating-bar,
    .wbm-wheel,
    .wbm-confetti-piece {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}