/* ==========================================================================
   Smart Trader Pro — Virtual Employee Web Chat Widget Styles
   Aesthetic: Dark Glassmorphism, Neon Blue / Cyan Accents, Smooth Animations
   ========================================================================== */

:root {
    --stp-primary: #3b82f6;
    --stp-primary-hover: #2563eb;
    --stp-primary-glow: rgba(59, 130, 246, 0.35);
    --stp-bg-dark: #090d16;
    --stp-panel-bg: rgba(13, 19, 33, 0.92);
    --stp-border: rgba(59, 130, 246, 0.22);
    --stp-border-subtle: rgba(255, 255, 255, 0.08);
    --stp-text-main: #f1f5f9;
    --stp-text-muted: #94a3b8;
    --stp-bot-bubble: rgba(30, 41, 59, 0.85);
    --stp-user-bubble: #2563eb;
}

/* ==========================================================================
   Floating Trigger Container & Animated Speech Bubble
   ========================================================================== */

#stp-chat-trigger-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    animation: stpBobbing 5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes stpBobbing {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-14px);
    }
}

/* Floating Speech Bubble */
.stp-speech-bubble {
    pointer-events: auto;
    background: rgba(13, 19, 33, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(59, 130, 246, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(59, 130, 246, 0.3);
    border-radius: 16px;
    border-bottom-right-radius: 4px;
    padding: 8px 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: #93c5fd;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transform-origin: bottom right;
    transition: transform 0.2s ease, opacity 0.25s ease, background 0.2s ease;
    user-select: none;
}

.stp-speech-bubble:hover {
    transform: scale(1.05) translateY(-2px);
    background: rgba(15, 23, 42, 0.98);
    color: #ffffff;
    border-color: #60a5fa;
}

.stp-speech-bubble.stp-bubble-hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.stp-speech-text {
    display: inline-block;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.stp-text-fade-out {
    opacity: 0;
    transform: translateY(-4px);
}

.stp-text-fade-in {
    opacity: 1;
    transform: translateY(0);
}

/* Floating Robot Trigger Button (Pure Image, No Background) */
#stp-chat-trigger {
    pointer-events: auto;
    position: relative;
    width: 150px;
    height: 135px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#stp-chat-trigger:hover {
    transform: scale(1.08);
}

.stp-trigger-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 24px rgba(59, 130, 246, 0.5)) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
    transition: transform 0.25s ease, filter 0.25s ease;
}

#stp-chat-trigger:hover .stp-trigger-img {
    filter: drop-shadow(0 14px 32px rgba(59, 130, 246, 0.7)) drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7));
}

#stp-chat-trigger .stp-trigger-badge {
    position: absolute;
    top: 10px;
    right: 18px;
    width: 15px;
    height: 15px;
    background: #10b981;
    border: 2.5px solid #090d16;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
}

/* Chat Main Panel */
#stp-chat-panel {
    position: fixed;
    bottom: 155px;
    right: 20px;
    z-index: 99999;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 180px);
    background: var(--stp-panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--stp-border);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(59, 130, 246, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    transform-origin: bottom right;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

#stp-chat-panel.stp-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Header */
.stp-chat-header {
    padding: 16px 20px;
    background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid var(--stp-border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stp-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stp-bot-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    filter: drop-shadow(0 0 8px var(--stp-primary-glow));
    overflow: hidden;
}

.stp-header-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}



.stp-bot-info h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--stp-text-main);
    letter-spacing: -0.2px;
}

.stp-bot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #10b981;
    margin-top: 2px;
}

.stp-status-dot {
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px #10b981;
}

.stp-header-close {
    background: transparent;
    border: none;
    color: var(--stp-text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: color 0.15s ease, background 0.15s ease;
}

.stp-header-close:hover {
    color: var(--stp-text-main);
    background: rgba(255, 255, 255, 0.08);
}

/* Messages Area */
.stp-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.stp-chat-messages::-webkit-scrollbar {
    width: 5px;
}

.stp-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

/* Bubbles */
.stp-msg {
    display: flex;
    flex-direction: column;
    max-width: 84%;
    animation: stpFadeIn 0.25s ease-out;
}

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

.stp-msg-bot {
    align-self: flex-start;
}

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

.stp-bubble {
    padding: 11px 15px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.stp-msg-bot .stp-bubble {
    background: var(--stp-bot-bubble);
    color: var(--stp-text-main);
    border: 1px solid var(--stp-border-subtle);
    border-bottom-left-radius: 4px;
}

.stp-msg-user .stp-bubble {
    background: var(--stp-user-bubble);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 14px var(--stp-primary-glow);
}

.stp-msg-time {
    font-size: 10px;
    color: var(--stp-text-muted);
    margin-top: 4px;
    padding: 0 4px;
}

.stp-msg-user .stp-msg-time {
    align-self: flex-end;
}

/* Quick Action Chips */
.stp-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.stp-chip-btn {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.stp-chip-btn:hover {
    background: rgba(59, 130, 246, 0.28);
    color: #ffffff;
    border-color: #3b82f6;
}

/* Clickable Action & Academy Article Link Buttons in Bot Bubble */
.stp-chat-btn-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    margin-bottom: 2px;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 700;
    text-decoration: none;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.18) 0%, rgba(59, 130, 246, 0.28) 100%);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #93c5fd !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
    line-height: 1.3;
}

.stp-chat-btn-link:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff !important;
    border-color: #3b82f6;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

.stp-chat-btn-link[href*="wa.me"] {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.18) 0%, rgba(16, 185, 129, 0.25) 100%);
    border-color: rgba(37, 211, 102, 0.4);
    color: #86efac !important;
}

.stp-chat-btn-link[href*="wa.me"]:hover {
    background: linear-gradient(135deg, #25d366 0%, #16a34a 100%);
    color: #ffffff !important;
    border-color: #25d366;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
}

/* Typing Indicator */
.stp-typing-indicator {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: var(--stp-bot-bubble);
    border: 1px solid var(--stp-border-subtle);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    align-self: flex-start;
}

.stp-typing-indicator.stp-active {
    display: flex;
}

.stp-dot {
    width: 6px;
    height: 6px;
    background: var(--stp-text-muted);
    border-radius: 50%;
    animation: stpPulse 1.2s infinite ease-in-out;
}

.stp-dot:nth-child(2) { animation-delay: 0.2s; }
.stp-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes stpPulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; background: #3b82f6; }
}

/* Inline Lead Card */
.stp-lead-card {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 16px;
    padding: 14px;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.stp-lead-card h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #93c5fd;
}

.stp-lead-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 12px;
    color: var(--stp-text-main);
    outline: none;
    transition: border-color 0.15s ease;
}

.stp-lead-input:focus {
    border-color: #3b82f6;
}

.stp-lead-submit {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    border-radius: 8px;
    color: white;
    padding: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.stp-lead-submit:hover {
    opacity: 0.9;
}

/* Footer Input Area */
.stp-chat-footer {
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.9);
    border-top: 1px solid var(--stp-border-subtle);
    display: flex;
    align-items: center;
    gap: 8px;
}

.stp-input-wrapper {
    flex: 1;
    position: relative;
}

.stp-chat-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--stp-text-main);
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.stp-chat-input:focus {
    border-color: #3b82f6;
    background: rgba(30, 41, 59, 0.9);
}

.stp-chat-input::placeholder {
    color: var(--stp-text-muted);
}

.stp-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--stp-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.1s ease;
    flex-shrink: 0;
}

.stp-send-btn:hover {
    background: var(--stp-primary-hover);
    transform: scale(1.04);
}

.stp-send-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
    transform: none;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #stp-chat-trigger-container {
        bottom: 12px;
        right: 12px;
        gap: 4px;
    }
    #stp-chat-trigger {
        width: 96px;
        height: 86px;
    }
    #stp-chat-trigger .stp-trigger-badge {
        top: 6px;
        right: 12px;
        width: 12px;
        height: 12px;
    }
    .stp-speech-bubble {
        font-size: 11px;
        padding: 6px 10px;
    }
    #stp-chat-panel {
        right: 10px;
        bottom: 110px;
        width: calc(100vw - 20px);
        height: calc(100vh - 130px);
        border-radius: 20px;
    }
}

