/* ==========================================
   Nova Lead Qualification Widget Styles
   ========================================== */

:root {
    --nv-q-bg: rgba(18, 20, 29, 0.95);
    --nv-q-border: rgba(255, 255, 255, 0.12);
    --nv-q-accent: #6366f1;
    --nv-q-accent-hover: #4f46e5;
    --nv-q-accent-glow: rgba(99, 102, 241, 0.35);
    --nv-q-text-main: #f8fafc;
    --nv-q-text-muted: #94a3b8;
    --nv-q-bubble-ai: #1e293b;
    --nv-q-bubble-user: #4338ca;
    --nv-q-radius: 16px;
}

/* Floating Launcher Container */
.nv-qualifier-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
}

/* Teaser Bubble Tooltip */
.nv-q-teaser {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    background: var(--nv-q-bg);
    border: 1px solid var(--nv-q-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--nv-q-text-main);
    padding: 12px 16px;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    font-size: 13.5px;
    line-height: 1.4;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nv-q-teaser.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.nv-q-teaser-close {
    background: transparent;
    border: none;
    color: var(--nv-q-text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.nv-q-teaser-close:hover {
    color: #fff;
}

/* Launcher Button */
.nv-q-launcher {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #3b82f6 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px var(--nv-q-accent-glow), 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
    position: relative;
}

.nv-q-launcher:hover {
    transform: scale(1.06);
    box-shadow: 0 12px 32px var(--nv-q-accent-glow), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.nv-q-launcher-icon {
    width: 26px;
    height: 26px;
    transition: transform 0.3s ease, opacity 0.2s ease;
}

.nv-q-launcher .icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg) scale(0.7);
}

.nv-qualifier-widget.is-open .nv-q-launcher .icon-chat {
    opacity: 0;
    transform: rotate(90deg) scale(0.7);
}

.nv-qualifier-widget.is-open .nv-q-launcher .icon-close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* Pulse Badge */
.nv-q-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #10b981;
    border: 2.5px solid #0f172a;
    border-radius: 50%;
}

.nv-q-badge::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.6);
    animation: nvPulse 2s infinite;
}

@keyframes nvPulse {
    0% { transform: scale(0.9); opacity: 0.8; }
    70% { transform: scale(1.8); opacity: 0; }
    100% { transform: scale(0.9); opacity: 0; }
}

/* Chat Drawer Window */
.nv-q-window {
    position: absolute;
    bottom: calc(100% + 16px);
    right: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: var(--nv-q-bg);
    border: 1px solid var(--nv-q-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--nv-q-radius);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nv-qualifier-widget.is-open .nv-q-window {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.nv-q-header {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--nv-q-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nv-q-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nv-q-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    box-shadow: 0 2px 8px var(--nv-q-accent-glow);
}

.nv-q-header-name {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: var(--nv-q-text-main);
    line-height: 1.2;
}

.nv-q-header-status {
    font-size: 12px;
    color: #10b981;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.nv-q-status-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
}

/* Progress bar inside window */
.nv-q-progress-bar {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
}

.nv-q-progress-fill {
    height: 100%;
    width: 20%;
    background: linear-gradient(90deg, #6366f1, #10b981);
    transition: width 0.4s ease;
}

/* Messages Body */
.nv-q-body {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.nv-q-body::-webkit-scrollbar {
    width: 4px;
}
.nv-q-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* Message Bubble */
.nv-q-msg {
    display: flex;
    flex-direction: column;
    max-width: 86%;
    animation: nvFadeUp 0.3s ease forwards;
}

@keyframes nvFadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.nv-q-msg.ai {
    align-self: flex-start;
}

.nv-q-msg.user {
    align-self: flex-end;
}

.nv-q-bubble {
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--nv-q-text-main);
}

.nv-q-msg.ai .nv-q-bubble {
    background: var(--nv-q-bubble-ai);
    border: 1px solid var(--nv-q-border);
    border-top-left-radius: 4px;
}

.nv-q-msg.user .nv-q-bubble {
    background: var(--nv-q-bubble-user);
    color: #fff;
    border-top-right-radius: 4px;
}

/* Choice Pills Options Container */
.nv-q-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    animation: nvFadeUp 0.35s ease forwards;
}

.nv-q-pill {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--nv-q-text-main);
    padding: 9px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nv-q-pill:hover {
    background: var(--nv-q-accent);
    border-color: var(--nv-q-accent);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--nv-q-accent-glow);
}

.nv-q-pill:active {
    transform: scale(0.97);
}

/* Quick Form Input inside chat */
.nv-q-form-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--nv-q-border);
    padding: 14px;
    border-radius: 12px;
    animation: nvFadeUp 0.35s ease forwards;
}

.nv-q-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.nv-q-input:focus {
    border-color: var(--nv-q-accent);
    box-shadow: 0 0 0 2px var(--nv-q-accent-glow);
}

.nv-q-submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #6366f1, #3b82f6);
    color: #fff;
    border: none;
    padding: 11px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.nv-q-submit-btn:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

/* Typing Indicator Animation */
.nv-q-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: var(--nv-q-bubble-ai);
    border: 1px solid var(--nv-q-border);
    border-radius: 14px;
    border-top-left-radius: 4px;
    width: fit-content;
}

.nv-q-typing span {
    width: 6px;
    height: 6px;
    background: var(--nv-q-text-muted);
    border-radius: 50%;
    animation: nvBounce 1.4s infinite ease-in-out both;
}

.nv-q-typing span:nth-child(1) { animation-delay: -0.32s; }
.nv-q-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes nvBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Footer note */
.nv-q-footer-note {
    padding: 10px;
    text-align: center;
    font-size: 11px;
    color: var(--nv-q-text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Mobile Responsiveness & Bottom Sheet View */
@media (max-width: 640px) {
    .nv-qualifier-widget {
        bottom: 16px;
        right: 16px;
    }

    .nv-q-teaser {
        right: 0;
        bottom: calc(100% + 10px);
        max-width: calc(100vw - 32px);
        font-size: 12.5px;
        padding: 10px 14px;
    }

    .nv-q-window {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100vw;
        height: 82vh;
        max-width: 100vw;
        max-height: 82vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        border-bottom: none;
    }

    .nv-qualifier-widget.is-open .nv-q-window {
        transform: translateY(0);
    }
}
