#advisio-chat-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.advisio-hidden {
    display: none !important;
}

/* Launcher Button */
#advisio-launcher {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background-color: var(--advisio-primary, #6366F1);
    color: #FFFFFF;
    border: none;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}

#advisio-launcher:hover {
    transform: scale(1.06);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.45);
}

.advisio-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.advisio-icon svg {
    width: 100%;
    height: 100%;
}

.advisio-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Proactive Greeting Bubble */
#advisio-proactive-bubble {
    position: absolute;
    bottom: 76px;
    right: 0;
    background: #FFFFFF;
    color: #0F172A;
    padding: 12px 18px;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 8px 25px rgba(15, 23, 42, 0.16);
    border: 1px solid #E2E8F0;
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    animation: advisioBounceIn 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes advisioBounceIn {
    0% { transform: scale(0.7) translateY(10px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Chat Window */
#advisio-chat-window {
    position: absolute;
    bottom: 78px;
    right: 0;
    width: 380px;
    height: 620px;
    max-height: 82vh;
    background: #FFFFFF;
    border-radius: 18px;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.24);
    border: 1px solid rgba(226, 232, 240, 0.9);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: advisioSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes advisioSlideUp {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.advisio-chat-header {
    background: var(--advisio-header, #1E293B);
    color: #FFFFFF;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.advisio-online-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #10B981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
}

.advisio-chat-header h3 {
    margin: 0;
    font-size: 15.5px;
    font-weight: 600;
    color: #FFFFFF;
}

#advisio-close-chat {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
}

#advisio-close-chat:hover {
    color: #FFFFFF;
}

/* Chat Body */
.advisio-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #F8FAFC;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.advisio-msg-row {
    display: flex;
    width: 100%;
}

.advisio-msg-row.user {
    justify-content: flex-end;
}

.advisio-msg-row.bot {
    justify-content: flex-start;
}

.advisio-bubble {
    max-width: 82%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.advisio-msg-row.user .advisio-bubble {
    background: var(--advisio-primary, #6366F1);
    color: #FFFFFF;
    border-bottom-right-radius: 4px;
}

.advisio-msg-row.bot .advisio-bubble {
    background: #FFFFFF;
    color: #1E293B;
    border: 1px solid #E2E8F0;
    border-bottom-left-radius: 4px;
}

/* Safe Clickable Subpage & Form Markdown Links (.fg-chat-link) */
.advisio-bubble a.fg-chat-link {
    display: inline-block;
    color: var(--advisio-primary, #6366F1);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    margin-top: 2px;
    transition: opacity 0.2s ease;
}

.advisio-bubble a.fg-chat-link:hover {
    opacity: 0.82;
}

.advisio-msg-row.user .advisio-bubble a.fg-chat-link {
    color: #FFFFFF;
}

/* Quick-Reply Chips */
.advisio-chips-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: -2px;
    margin-bottom: 6px;
    padding-left: 2px;
}

.advisio-chip {
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    color: #334155;
    padding: 7px 13px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.3;
}

.advisio-chip:hover {
    background: #F1F5F9;
    border-color: var(--advisio-primary, #6366F1);
    color: #0F172A;
}

.advisio-chip-primary {
    background: var(--advisio-primary, #6366F1);
    color: #FFFFFF;
    border-color: var(--advisio-primary, #6366F1);
    font-weight: 600;
}

.advisio-chip-primary:hover {
    filter: brightness(0.93);
    background: var(--advisio-primary, #6366F1);
    color: #FFFFFF;
}

/* Typing Indicator */
.advisio-typing .advisio-bubble {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px;
}

.advisio-typing span {
    animation: advisioBlink 1.4s infinite both;
    width: 6px;
    height: 6px;
    background: #64748B;
    border-radius: 50%;
    display: inline-block;
}

.advisio-typing span:nth-child(2) { animation-delay: 0.2s; }
.advisio-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes advisioBlink {
    0% { opacity: 0.25; transform: translateY(0); }
    20% { opacity: 1; transform: translateY(-2px); }
    100% { opacity: 0.25; transform: translateY(0); }
}

/* Dynamic Lead Form Drawer */
#advisio-lead-form-container {
    padding: 16px 18px;
    background: #F1F5F9;
    border-top: 1px solid #CBD5E1;
    max-height: 68%;
    overflow-y: auto;
}

.advisio-lead-form p#advisio-lead-title-text {
    margin: 0 0 10px 0;
    font-size: 13.5px;
    font-weight: 600;
    color: #0F172A;
}

.advisio-contact-method-group {
    margin-bottom: 10px;
}

.advisio-contact-method-label {
    display: block;
    font-size: 12px;
    color: #475569;
    margin-bottom: 5px;
    font-weight: 500;
}

.advisio-contact-pills {
    display: flex;
    gap: 8px;
}

.advisio-contact-pill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border-radius: 8px;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    font-size: 12.5px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
}

.advisio-contact-pill input[type="radio"] {
    display: none;
}

.advisio-contact-pill.active {
    background: var(--advisio-primary, #6366F1);
    color: #FFFFFF;
    border-color: var(--advisio-primary, #6366F1);
}

.advisio-lead-field-wrap {
    margin-bottom: 8px;
}

.advisio-dyn-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    background: #FFFFFF;
    color: #0F172A;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.2s;
}

.advisio-dyn-input:focus {
    border-color: var(--advisio-primary, #6366F1);
}

.advisio-input-error {
    border-color: #EF4444 !important;
    background: #FEF2F2 !important;
}

.advisio-lead-actions {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.advisio-btn {
    background: var(--advisio-primary, #6366F1);
    color: #FFFFFF;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13.5px;
    width: 100%;
    transition: filter 0.2s;
}

.advisio-btn:hover {
    filter: brightness(0.93);
}

.advisio-btn-cancel {
    background: transparent;
    color: #64748B;
    border: none;
    padding: 6px;
    width: 100%;
    cursor: pointer;
    font-size: 12.5px;
}

.advisio-btn-cancel:hover {
    color: #0F172A;
}

.advisio-lead-success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #10B981;
    padding: 14px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 13.5px;
}

/* Footer Input Area */
.advisio-chat-footer {
    padding: 12px 15px;
    background: #FFFFFF;
    border-top: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    gap: 10px;
}

#advisio-chat-input {
    flex: 1;
    border: 1px solid #CBD5E1;
    padding: 10px 15px;
    border-radius: 999px;
    font-size: 14px;
    color: #0F172A;
    outline: none;
    transition: border-color 0.2s;
}

#advisio-chat-input:focus {
    border-color: var(--advisio-primary, #6366F1);
}

#advisio-chat-input:disabled {
    background-color: #F1F5F9;
    cursor: not-allowed;
}

#advisio-chat-send {
    background: var(--advisio-primary, #6366F1);
    color: #FFFFFF;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: filter 0.2s, opacity 0.2s;
}

#advisio-chat-send:hover {
    filter: brightness(0.92);
}

#advisio-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#advisio-chat-send svg {
    width: 18px;
    height: 18px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #advisio-chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    #advisio-launcher {
        bottom: 16px;
        right: 16px;
    }
}
