/* ==========================================================================
   🤖 STYLE B: SLIM BOTTOM SMART CAPSULE BAR + REARRANGED MOBILE POP-OUT
   Learn.AfolksDigital — High-Converting, Modern, Non-Intrusive Floating Bar
   ========================================================================== */

#aiCareerWidget {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: min(920px, calc(100% - 32px));
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    filter: drop-shadow(0 20px 42px rgba(15, 23, 42, 0.45));
    animation: aiBarSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

@keyframes aiBarSlideUp {
    from {
        transform: translate(-50%, 45px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes aiScanGlow {
    0%, 100% {
        box-shadow: 0 4px 18px rgba(124, 58, 237, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 0 6px 26px rgba(236, 72, 153, 0.6), 0 0 0 2px rgba(236, 72, 153, 0.3);
    }
}

@keyframes aiPulseDot {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.35);
        opacity: 0.7;
    }
}

/* Glassmorphic Capsule Container */
.ai-bar-inner {
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1.5px solid rgba(168, 85, 247, 0.45);
    border-radius: 40px;
    padding: 10px 14px 10px 18px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* Left Group */
.ai-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.ai-bar-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
    padding: 6px 13px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

.ai-bar-dot {
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: aiPulseDot 2s infinite ease-in-out;
}

/* Dialogue Text */
.ai-bar-message {
    font-size: 13.5px;
    line-height: 1.4;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    transition: opacity 0.25s ease;
}

.ai-bar-punchline {
    color: #fb7185;
    font-weight: 800;
    margin-left: 4px;
}

/* Right Group */
.ai-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Glowing CTA Button */
.ai-bar-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: linear-gradient(135deg, #7c3aed 0%, #9333ea 50%, #ec4899 100%);
    border: none;
    border-radius: 28px;
    color: #ffffff !important;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.2px;
    cursor: pointer;
    animation: aiScanGlow 3s infinite ease-in-out;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
    text-decoration: none !important;
    white-space: nowrap;
}

.ai-bar-cta:hover {
    transform: scale(1.03) translateY(-1px);
}

.ai-bar-cta:active {
    transform: scale(0.98);
}

/* Close Button */
.ai-bar-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}

.ai-bar-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

/* ==========================================================================
   MINIMIZED HOST & POP-OUT SPEECH BUBBLE (NON-INTRUSIVE REARRANGEMENT)
   ========================================================================== */
#aiMinimizedHost {
    position: fixed;
    bottom: 22px;
    right: 24px;
    z-index: 9999;
    display: none;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

[dir="rtl"] #aiMinimizedHost,
html[lang="ur"] #aiMinimizedHost {
    right: auto;
    left: 24px;
}

/* Speech Bubble */
.ai-speech-bubble {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    width: 320px;
    max-width: calc(100vw - 32px);
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1.5px solid rgba(168, 85, 247, 0.6);
    border-radius: 18px;
    padding: 12px 14px;
    color: #ffffff;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55), 0 0 20px rgba(124, 58, 237, 0.28);
    transform-origin: bottom right;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    cursor: pointer;
}

[dir="rtl"] .ai-speech-bubble,
html[lang="ur"] .ai-speech-bubble {
    right: auto;
    left: 0;
    transform-origin: bottom left;
}

/* Speech Bubble Pointer Tail */
.ai-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -7px;
    right: 20px;
    width: 14px;
    height: 14px;
    background: rgba(15, 23, 42, 0.96);
    border-right: 1.5px solid rgba(168, 85, 247, 0.6);
    border-bottom: 1.5px solid rgba(168, 85, 247, 0.6);
    transform: rotate(45deg);
}

[dir="rtl"] .ai-speech-bubble::after,
html[lang="ur"] .ai-speech-bubble::after {
    right: auto;
    left: 20px;
    border-right: none;
    border-left: 1.5px solid rgba(168, 85, 247, 0.6);
    border-bottom: 1.5px solid rgba(168, 85, 247, 0.6);
}

/* Bubble Active Pop States */
.ai-speech-bubble.ai-bubble-hidden {
    opacity: 0;
    transform: translateY(12px) scale(0.9);
    pointer-events: none;
}

.ai-speech-bubble.ai-bubble-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.ai-bubble-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.ai-bubble-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #c084fc;
}

.ai-bubble-tag-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px #10b981;
    animation: aiPulseDot 2s infinite ease-in-out;
}

.ai-bubble-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
}

.ai-bubble-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.ai-bubble-body {
    font-size: 12.5px;
    line-height: 1.45;
    color: #f1f5f9;
    margin-bottom: 8px;
    min-height: 34px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.ai-bubble-punchline {
    color: #fb7185;
    font-weight: 800;
    margin-top: 2px;
    display: block;
}

.ai-bubble-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-bubble-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
    border: none;
    border-radius: 20px;
    color: #ffffff !important;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(124, 58, 237, 0.4);
    transition: transform 0.15s;
    text-decoration: none !important;
    white-space: nowrap;
}

.ai-bubble-action:hover {
    transform: scale(1.04);
}

.ai-bubble-restore-link {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 4px;
    text-decoration: underline;
    transition: color 0.15s;
}

.ai-bubble-restore-link:hover {
    color: #ffffff;
}

/* Floating Launcher Pill / FAB */
.ai-launcher-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px 8px 10px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid rgba(168, 85, 247, 0.55);
    border-radius: 36px;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-launcher-pill:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 16px 36px rgba(124, 58, 237, 0.5);
}

.ai-launcher-icon {
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
}

/* Highlight Target Animation on AI Bootcamp Card */
@keyframes aiCardPulseHighlight {
    0% {
        box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.7);
        outline: 3px solid #8b5cf6;
    }
    50% {
        box-shadow: 0 0 0 16px rgba(168, 85, 247, 0);
        outline: 3px solid #ec4899;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(168, 85, 247, 0);
        outline: 3px solid transparent;
    }
}

.ai-payment-focused {
    animation: aiCardPulseHighlight 1.2s ease-out 3;
    outline: 3px solid #8b5cf6 !important;
    outline-offset: 4px;
    border-radius: 16px;
}

/* ==========================================================================
   📱 MOBILE REARRANGEMENT (<= 768px): ZERO DISTURBANCE TO THE VIEWER
   ========================================================================== */
@media (max-width: 768px) {
    /* 1. Main Bar on Mobile */
    #aiCareerWidget {
        bottom: 12px;
        width: calc(100% - 20px);
    }
    .ai-bar-inner {
        border-radius: 18px;
        padding: 10px 12px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .ai-bar-left {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .ai-bar-message {
        font-size: 12px;
        white-space: normal;
        line-height: 1.35;
        overflow: visible;
    }
    .ai-bar-punchline {
        display: inline;
        margin-left: 2px;
    }
    .ai-bar-right {
        width: 100%;
        display: flex;
    }
    .ai-bar-cta {
        width: 100%;
        justify-content: center;
        padding: 10px 14px;
        font-size: 12.5px;
        border-radius: 12px;
    }

    /* 2. Minimized Host: Low-Profile Floating Action Button (FAB) */
    #aiMinimizedHost {
        bottom: 14px;
        right: 12px;
    }
    [dir="rtl"] #aiMinimizedHost,
    html[lang="ur"] #aiMinimizedHost {
        right: auto;
        left: 12px;
    }

    /* Compact 44px circular FAB button so content is never blocked */
    .ai-launcher-pill {
        padding: 0;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        justify-content: center;
        background: rgba(15, 23, 42, 0.95);
        border: 2px solid rgba(168, 85, 247, 0.65);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 14px rgba(124, 58, 237, 0.35);
    }
    .ai-launcher-pill .ai-launcher-label {
        display: none; /* Hide text on mobile FAB, show only glowing bot icon */
    }
    .ai-launcher-icon {
        width: 100%;
        height: 100%;
        background: transparent;
        font-size: 20px;
        box-shadow: none;
    }

    /* 3. Rearranged Pop-Out Speech Bubble on Mobile */
    .ai-speech-bubble {
        bottom: calc(100% + 10px);
        right: 0;
        width: 260px;
        max-width: calc(100vw - 32px);
        border-radius: 14px;
        padding: 8px 10px;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6), 0 0 16px rgba(124, 58, 237, 0.25);
    }
    [dir="rtl"] .ai-speech-bubble,
    html[lang="ur"] .ai-speech-bubble {
        right: auto;
        left: 0;
    }

    .ai-speech-bubble::after {
        right: 14px;
        bottom: -6px;
        width: 12px;
        height: 12px;
    }
    [dir="rtl"] .ai-speech-bubble::after,
    html[lang="ur"] .ai-speech-bubble::after {
        right: auto;
        left: 14px;
    }

    /* Minimalist header & body on mobile */
    .ai-bubble-header {
        margin-bottom: 4px;
    }
    .ai-bubble-tag {
        font-size: 9.5px;
    }
    .ai-bubble-body {
        font-size: 11.5px;
        line-height: 1.35;
        margin-bottom: 6px;
        min-height: 28px;
    }
    .ai-bubble-punchline {
        font-size: 11.5px;
        margin-top: 2px;
    }
    .ai-bubble-footer {
        padding-top: 5px;
    }
    .ai-bubble-action {
        padding: 4px 10px;
        font-size: 10.5px;
    }
    .ai-bubble-restore-link {
        font-size: 10px;
    }
}
