/**
 * BLADE BOSS TOOL SHOWCASE MODAL
 * Premium tier-lock showcase with GIF demo + conversion CTA
 * 
 * Layout strategy:
 *   - Flex column: GIF (shrinks) + Sell bar (never shrinks)
 *   - GIF area caps at 55vh so sell bar is ALWAYS visible
 *   - Height media queries handle short laptops (768px, 600px)
 *   - Width media queries handle tablet (768px) and mobile (480px, 375px)
 *   - Sell bar is the conversion element — it must never scroll off-screen
 *
 * Tested viewports:
 *   Desktop:  1920x1080, 1440x900, 1366x768
 *   Laptop:   1280x720, 1024x768
 *   Tablet:   768x1024, 1024x768
 *   Mobile:   430x932, 414x896, 393x852, 390x844, 375x667
 * 
 * @version 2.0.0
 */

/* ===== SHARED FONT STACK ===== */
.bb-showcase-container,
.bb-showcase-container * {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    box-sizing: border-box;
}

/* ===== CONTAINER & BACKDROP ===== */
.bb-showcase-container {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
    overscroll-behavior: contain;
}

.bb-showcase-container.active {
    opacity: 1;
    visibility: visible;
}

.bb-showcase-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 12, 24, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    cursor: pointer;
}

/* ===== MAIN MODAL ===== */
.bb-showcase-modal {
    position: relative;
    width: 100%;
    max-width: 900px;
    max-height: calc(100vh - 32px);
    overflow: hidden;
    border-radius: 20px;
    background: #0c1222;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    transform: scale(0.92) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

.bb-showcase-container.active .bb-showcase-modal {
    transform: scale(1) translateY(0);
}

/* ===== ANIMATED LOCK BADGE (top-left corner) ===== */
.bb-showcase-lock-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.9), rgba(236, 72, 153, 0.9));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    z-index: 3;
    box-shadow:
        0 8px 32px rgba(139, 92, 246, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.06) inset;
    animation: bb-lock-rock 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes bb-lock-rock {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    15% {
        transform: translateY(-4px) rotate(-6deg);
    }
    30% {
        transform: translateY(-2px) rotate(5deg);
    }
    45% {
        transform: translateY(-4px) rotate(-3deg);
    }
    60% {
        transform: translateY(0) rotate(0deg);
    }
}

/* Glow pulse behind the badge */
.bb-showcase-lock-badge::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(236, 72, 153, 0.3));
    z-index: -1;
    animation: bb-lock-glow 3s ease-in-out infinite;
}

@keyframes bb-lock-glow {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.08); }
}

/* Responsive lock badge */
@media (max-width: 640px) {
    .bb-showcase-lock-badge {
        width: 50px;
        height: 50px;
        font-size: 24px;
        border-radius: 14px;
        top: 12px;
        left: 12px;
    }

    .bb-showcase-lock-badge::after {
        border-radius: 18px;
    }
}

@media (max-width: 360px) {
    .bb-showcase-lock-badge {
        width: 42px;
        height: 42px;
        font-size: 20px;
        border-radius: 12px;
    }
}

@supports (padding-top: env(safe-area-inset-top)) {
    @media (max-width: 640px) {
        .bb-showcase-lock-badge {
            top: calc(12px + env(safe-area-inset-top));
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .bb-showcase-lock-badge {
        animation: none;
    }

    .bb-showcase-lock-badge::after {
        animation: none;
    }
}

/* ===== CLOSE BUTTON ===== */
.bb-showcase-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
    transition: all 0.2s ease;
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
    line-height: 1;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.bb-showcase-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.95);
    transform: rotate(90deg);
}

.bb-showcase-close:active {
    transform: scale(0.92);
}

/* ===== GIF DEMO AREA =====
 * KEY: flex-shrink: 1 so it yields space to the sell bar.
 * max-height: 55vh prevents GIF from eating the viewport.
 * The <img> inside scales proportionally via object-fit.
 */
.bb-showcase-demo {
    position: relative;
    width: 100%;
    max-height: 55vh;
    background: #080e1a;
    overflow: hidden;
    flex-shrink: 1;
    min-height: 120px;
}

.bb-showcase-gif {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 55vh;
    object-fit: contain;
    background: #080e1a;
}

.bb-showcase-demo.loading {
    min-height: 200px;
}

.bb-showcase-demo.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.02) 25%,
        rgba(255, 255, 255, 0.06) 50%,
        rgba(255, 255, 255, 0.02) 75%
    );
    background-size: 200% 100%;
    animation: bb-showcase-shimmer 1.5s ease-in-out infinite;
}

@keyframes bb-showcase-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== SELL BAR (below GIF) =====
 * KEY: flex-shrink: 0 — this NEVER shrinks.
 * The GIF area above absorbs all height pressure.
 */
.bb-showcase-sell {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    padding: 20px 28px;
    background: rgba(10, 16, 30, 0.98);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

/* ===== LEFT: TOOL INFO ===== */
.bb-showcase-info {
    flex: 1;
    min-width: 0;
}

.bb-showcase-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.bb-showcase-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #00DC82, #009DFF);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.bb-showcase-tool-name {
    font-size: 17px;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.2;
    margin: 0;
}

.bb-showcase-tool-subtitle {
    font-size: 13px;
    color: #64748b;
    margin: 2px 0 0;
}

/* Pain point callout */
.bb-showcase-pain {
    background: rgba(0, 220, 130, 0.06);
    border: 1px solid rgba(0, 220, 130, 0.15);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
}

.bb-showcase-pain-label {
    font-size: 12px;
    font-weight: 600;
    color: #00DC82;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.bb-showcase-pain-text {
    font-size: 14px;
    color: #cbd5e1;
    line-height: 1.5;
    margin: 0;
}

.bb-showcase-pain-text em {
    color: #f1f5f9;
    font-style: italic;
}

/* Feature pills */
.bb-showcase-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bb-showcase-feature {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 6px 12px;
}

.bb-showcase-feature-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00DC82;
    flex-shrink: 0;
}

.bb-showcase-feature-text {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.3;
}

/* ===== RIGHT: UPGRADE CTA ===== */
.bb-showcase-cta {
    width: 210px;
    flex-shrink: 0;
    text-align: center;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bb-showcase-lock-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #8B5CF6, #EC4899);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin: 0 auto 10px;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.3);
}

.bb-showcase-unlock-title {
    font-size: 16px;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0 0 3px;
}

.bb-showcase-tier-req {
    font-size: 13px;
    color: #94a3b8;
    margin: 0 0 14px;
}

.bb-showcase-tier-name {
    color: #a78bfa;
    font-weight: 600;
}

.bb-showcase-upgrade-btn {
    display: block;
    width: 100%;
    padding: 13px 20px;
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

.bb-showcase-upgrade-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: left 0.5s;
}

.bb-showcase-upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.5);
}

.bb-showcase-upgrade-btn:hover::before {
    left: 100%;
}

.bb-showcase-upgrade-btn:active {
    transform: translateY(0) scale(0.97);
}

.bb-showcase-price {
    font-size: 13px;
    color: #64748b;
    margin: 8px 0 0;
}

.bb-showcase-price-amount {
    color: #a78bfa;
    font-weight: 600;
}

.bb-showcase-dismiss-wrap {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    width: 100%;
}

.bb-showcase-dismiss {
    background: none;
    border: none;
    color: #475569;
    font-size: 13px;
    cursor: pointer;
    padding: 6px 12px;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.bb-showcase-dismiss:hover {
    color: #94a3b8;
}


/* ==========================================================
   HEIGHT-BASED BREAKPOINTS
   Protects sell bar on short screens (laptops, landscape)
   ========================================================== */

/* Short laptops: 1366x768, 1280x720 */
@media (max-height: 800px) {
    .bb-showcase-demo {
        max-height: 45vh;
    }

    .bb-showcase-gif {
        max-height: 45vh;
    }

    .bb-showcase-sell {
        padding: 16px 24px;
    }

    .bb-showcase-pain {
        padding: 8px 12px;
        margin-bottom: 10px;
    }

    .bb-showcase-pain-text {
        font-size: 13px;
    }

    .bb-showcase-lock-icon {
        width: 42px;
        height: 42px;
        font-size: 19px;
        margin-bottom: 8px;
    }
}

/* Very short screens: 600-700px height (landscape phones, small laptops) */
@media (max-height: 650px) {
    .bb-showcase-container {
        padding: 8px;
    }

    .bb-showcase-modal {
        max-height: calc(100vh - 16px);
        border-radius: 14px;
    }

    .bb-showcase-demo {
        max-height: 35vh;
        min-height: 100px;
    }

    .bb-showcase-gif {
        max-height: 35vh;
    }

    .bb-showcase-sell {
        padding: 12px 18px;
        gap: 16px;
    }

    .bb-showcase-header {
        margin-bottom: 8px;
    }

    .bb-showcase-tool-name {
        font-size: 15px;
    }

    .bb-showcase-pain {
        padding: 7px 10px;
        margin-bottom: 8px;
    }

    .bb-showcase-pain-label {
        font-size: 11px;
    }

    .bb-showcase-pain-text {
        font-size: 12px;
        line-height: 1.4;
    }

    .bb-showcase-feature {
        padding: 4px 8px;
    }

    .bb-showcase-feature-text {
        font-size: 12px;
    }

    .bb-showcase-lock-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
        margin-bottom: 6px;
    }

    .bb-showcase-unlock-title {
        font-size: 14px;
    }

    .bb-showcase-upgrade-btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .bb-showcase-dismiss-wrap {
        margin-top: 6px;
        padding-top: 6px;
    }
}

/* Ultra-short: landscape phones (under 500px height) */
@media (max-height: 500px) {
    .bb-showcase-modal {
        flex-direction: row;
        max-height: calc(100vh - 16px);
        border-radius: 12px;
    }

    .bb-showcase-demo {
        max-height: none;
        max-width: 55%;
        flex-shrink: 1;
        min-height: 0;
    }

    .bb-showcase-gif {
        max-height: calc(100vh - 16px);
        height: 100%;
        object-fit: cover;
    }

    .bb-showcase-sell {
        flex-direction: column;
        overflow-y: auto;
        border-top: none;
        border-left: 1px solid rgba(255, 255, 255, 0.06);
        padding: 14px 16px;
        gap: 10px;
        max-width: 45%;
    }

    .bb-showcase-cta {
        width: 100%;
        border-left: none;
        padding-left: 0;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

    .bb-showcase-close {
        top: 8px;
        right: 8px;
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
}


/* ==========================================================
   WIDTH-BASED BREAKPOINTS
   ========================================================== */

/* Tablet + narrow desktops */
@media (max-width: 860px) {
    .bb-showcase-sell {
        padding: 18px 22px;
        gap: 20px;
    }

    .bb-showcase-cta {
        width: 190px;
        padding-left: 20px;
    }
}

/* ==========================================================
   MOBILE: STACKED LAYOUT
   Key changes from desktop:
   - Full screen takeover (no border radius, no padding)
   - Sell bar stacks vertically (info then CTA)
   - CTA uses CSS grid to go compact:
       Row 1: [lock icon] [title + tier] [maybe later]
       Row 2: [full-width upgrade button + price]
     This collapses 7 vertical elements into 2 tight rows
   - Safe area insets protect GIF from notch/status bar
   ========================================================== */
@media (max-width: 640px) {
    .bb-showcase-container {
        padding: 0;
    }

    .bb-showcase-modal {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }

    .bb-showcase-demo {
        max-height: 38vh;
        flex-shrink: 1;
    }

    .bb-showcase-gif {
        max-height: 38vh;
    }

    .bb-showcase-sell {
        flex-direction: column;
        gap: 14px;
        padding: 16px 18px;
        overflow-y: auto;
        flex: 1;
        -webkit-overflow-scrolling: touch;
    }

    .bb-showcase-close {
        top: 10px;
        right: 10px;
    }

    /* ---- COMPACT CTA: grid layout ---- */
    .bb-showcase-cta {
        width: 100%;
        border-left: none;
        padding-left: 0;
        padding-top: 14px;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        text-align: left;
        display: grid;
        grid-template-columns: 38px 1fr auto;
        grid-template-rows: auto auto auto auto;
        column-gap: 10px;
        row-gap: 0;
        align-items: center;
    }

    .bb-showcase-lock-icon {
        grid-column: 1;
        grid-row: 1 / 3;
        width: 38px;
        height: 38px;
        font-size: 17px;
        border-radius: 10px;
        margin: 0;
        box-shadow: 0 4px 14px rgba(139, 92, 246, 0.25);
    }

    .bb-showcase-unlock-title {
        grid-column: 2;
        grid-row: 1;
        font-size: 15px;
        margin: 0;
        line-height: 1.3;
    }

    .bb-showcase-tier-req {
        grid-column: 2;
        grid-row: 2;
        font-size: 13px;
        margin: 0;
        line-height: 1.3;
    }

    .bb-showcase-dismiss-wrap {
        grid-column: 3;
        grid-row: 1 / 3;
        margin: 0;
        padding: 0;
        border: none;
        width: auto;
    }

    .bb-showcase-dismiss {
        font-size: 13px;
        color: #64748b;
        padding: 8px 4px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .bb-showcase-upgrade-btn {
        grid-column: 1 / 4;
        grid-row: 3;
        margin-top: 12px;
        padding: 14px 20px;
        font-size: 16px;
        min-height: 48px;
    }

    .bb-showcase-price {
        grid-column: 1 / 4;
        grid-row: 4;
        text-align: center;
        font-size: 12px;
        margin: 6px 0 0;
    }
}

/* Small mobile (iPhone SE, older Androids) */
@media (max-width: 420px) {
    .bb-showcase-sell {
        padding: 14px 16px;
        gap: 12px;
    }

    .bb-showcase-tool-name {
        font-size: 15px;
    }

    .bb-showcase-tool-subtitle {
        font-size: 12px;
    }

    .bb-showcase-icon {
        width: 34px;
        height: 34px;
        font-size: 16px;
        border-radius: 9px;
    }

    .bb-showcase-pain {
        padding: 8px 10px;
    }

    .bb-showcase-pain-text {
        font-size: 13px;
    }

    .bb-showcase-features {
        gap: 5px;
    }

    .bb-showcase-feature {
        padding: 5px 9px;
    }

    .bb-showcase-feature-text {
        font-size: 12px;
    }
}

/* Tiny mobile (320px width, old devices, accessibility zoom) */
@media (max-width: 360px) {
    .bb-showcase-sell {
        padding: 12px 14px;
    }

    .bb-showcase-header {
        gap: 8px;
    }

    .bb-showcase-tool-name {
        font-size: 14px;
    }

    .bb-showcase-feature {
        padding: 4px 7px;
    }

    .bb-showcase-feature-text {
        font-size: 11px;
    }

    .bb-showcase-upgrade-btn {
        font-size: 15px;
        padding: 13px 16px;
    }

    .bb-showcase-cta {
        grid-template-columns: 32px 1fr auto;
        column-gap: 8px;
    }

    .bb-showcase-lock-icon {
        width: 32px;
        height: 32px;
        font-size: 15px;
        border-radius: 8px;
    }

    .bb-showcase-unlock-title {
        font-size: 14px;
    }

    .bb-showcase-tier-req {
        font-size: 12px;
    }
}


/* ==========================================================
   COMBINED: SHORT HEIGHT + MOBILE WIDTH
   Landscape phones
   ========================================================== */
@media (max-width: 640px) and (max-height: 500px) {
    .bb-showcase-modal {
        flex-direction: row;
        border-radius: 0;
    }

    .bb-showcase-demo {
        max-height: 100%;
        max-width: 50%;
        min-height: 0;
    }

    .bb-showcase-gif {
        max-height: 100vh;
        height: 100%;
        object-fit: cover;
    }

    .bb-showcase-sell {
        max-width: 50%;
        border-left: 1px solid rgba(255, 255, 255, 0.06);
        border-top: none;
        flex: 1;
    }

    .bb-showcase-cta {
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }
}


/* ==========================================================
   SAFE AREAS (notched phones, PWA, status bar)
   Critical: protects GIF from being cut off at top
   ========================================================== */
@supports (padding-top: env(safe-area-inset-top)) {
    @media (max-width: 640px) {
        .bb-showcase-modal {
            padding-top: env(safe-area-inset-top);
        }

        .bb-showcase-close {
            top: calc(10px + env(safe-area-inset-top));
        }

        .bb-showcase-sell {
            padding-bottom: calc(16px + env(safe-area-inset-bottom));
        }
    }
}


/* ==========================================================
   REDUCED MOTION
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
    .bb-showcase-modal {
        transition: opacity 0.2s ease;
        transform: none;
    }

    .bb-showcase-container.active .bb-showcase-modal {
        transform: none;
    }

    .bb-showcase-close:hover {
        transform: none;
    }

    .bb-showcase-upgrade-btn:hover {
        transform: none;
    }

    .bb-showcase-demo.loading::after {
        animation: none;
    }
}