/* ── Blueshore AI Agent Chat Widget Stylesheet ── */

.ai-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 64px);
    height: 520px;
    max-height: calc(100vh - 140px);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(30px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #0B1221;
}
html:not(.dark) .ai-chat-window {
    background: #ffffff;
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 20px 50px rgba(0,0,0,0.12);
}
.ai-chat-window.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}
.ai-chat-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(55,144,255,0.15) 0%, rgba(55,144,255,0.1) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
html:not(.dark) .ai-chat-header {
    border-bottom-color: rgba(0,0,0,0.06);
}
.ai-chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3790ff 0%, #3790ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #030816;
    font-weight: 700;
    box-shadow: 0 0 12px rgba(55,144,255,0.35);
}
.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ai-chat-msg {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
}
.ai-chat-msg.agent {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #f8fafc;
    border-bottom-left-radius: 4px;
}
html:not(.dark) .ai-chat-msg.agent {
    background: #f1f5f9;
    border-color: rgba(0,0,0,0.05);
    color: #0f172a;
}
.ai-chat-msg.user {
    align-self: flex-end;
    background: #3790ff;
    color: #030816;
    font-weight: 500;
    border-bottom-right-radius: 4px;
}
.ai-chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(0,0,0,0.15);
}
html:not(.dark) .ai-chat-input-area {
    border-top-color: rgba(0,0,0,0.06);
    background: rgba(0,0,0,0.01);
}
.ai-chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 100px !important;
    padding: 10px 18px !important;
    font-size: 13px !important;
    color: #f8fafc !important;
    outline: none !important;
}
html:not(.dark) .ai-chat-input {
    background: #f8fafc !important;
    border-color: rgba(0,0,0,0.1) !important;
    color: #0f172a !important;
}
.ai-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #3790ff;
    border: none;
    color: #030816;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.ai-chat-send:hover {
    transform: scale(1.08);
    background: #5da2ff;
}
.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}
html:not(.dark) .typing-indicator {
    background: #f1f5f9;
    border-color: rgba(0,0,0,0.05);
}
.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #64748b;
    animation: typingBounce 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Streaming cursor */
.streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 14px;
    background: #3790ff;
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink-cursor 0.8s infinite;
}
@keyframes blink-cursor {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Mode badge */
.ai-mode-badge {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    transition: all 0.3s ease;
}
.ai-mode-badge.ai-connected {
    color: #22c55e;
}

/* Disabled input state */
.ai-chat-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.ai-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Light mode: API key panel */
html:not(.dark) #api-key-panel {
    background: rgba(0,0,0,0.02) !important;
    border-bottom-color: rgba(0,0,0,0.06) !important;
}
html:not(.dark) #api-key-panel p { color: #475569 !important; }
html:not(.dark) #gemini-key-input {
    background: #f8fafc !important;
    border-color: rgba(0,0,0,0.1) !important;
    color: #0f172a !important;
}

/* Ensure hover tooltips are always white text, overriding light mode color changes */
#ai-agent-toggle-btn span.absolute,
a[href*="wa.me"] span.absolute {
    color: #ffffff !important;
}

/* Ensure reading badges on blog cards remain white text in light mode */
.reading-badge,
.reading-badge * {
    color: #ffffff !important;
}

/* Ensure the AI Agent toggle button and WhatsApp buttons have identical look across all pages */
#ai-agent-toggle-btn,
a[href*="wa.me"]:not(.hub-menu-btn) {
    border-radius: 0.75rem !important; /* Force the rounded square shape of the index page */
}

/* ── Support Hub Styles (Global — PC and Mobile) ── */
#support-hub {
    display: block !important;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

@media (max-width: 767px) {
    #support-hub {
        bottom: 16px;
        right: 16px;
    }
}

/* Always hide standard standalone buttons since we stack them in the hub menu */
#ai-agent-toggle-btn,
a[href*="wa.me"]:not(.hub-menu-btn):not(.hub-menu-item) {
    display: none !important;
}

#support-hub-trigger {
    width: 56px;
    height: 56px;
    border-radius: 50% !important; /* Circular floating button */
    background: #3790ff;
    color: #030816;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: 0 4px 20px rgba(55,144,255, 0.35);
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 767px) {
    #support-hub-trigger {
        width: 48px;
        height: 48px;
    }
}

#support-hub-trigger.active {
    background: #0B1221;
    color: #3790ff;
    border: 1px solid rgba(55,144,255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transform: rotate(90deg);
}

html:not(.dark) #support-hub-trigger.active {
    background: #f1f5f9;
    color: #3790ff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

#support-hub-menu {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 56px;
    height: auto;
    pointer-events: none;
}

@media (max-width: 767px) {
    #support-hub-menu {
        width: 48px;
    }
}

.hub-menu-btn {
    position: absolute !important;
    right: 6px !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
    cursor: pointer !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    /* Collapsed state: centered behind the trigger */
    bottom: 6px !important;
    transform: scale(0.3) !important;
    z-index: -1 !important;
}

@media (max-width: 767px) {
    .hub-menu-btn {
        right: 4px !important;
        width: 40px !important;
        height: 40px !important;
        bottom: 4px !important;
    }
}

/* Staggered vertical pop-up animations when active */
#support-hub-menu.active .hub-btn-whatsapp {
    bottom: 72px !important; /* 56px trigger + 16px gap */
    opacity: 1 !important;
    transform: scale(1) !important;
    pointer-events: auto !important;
    transition-delay: 0.04s;
}

#support-hub-menu.active .hub-btn-ai {
    bottom: 128px !important; /* 72px + 44px + 12px gap */
    opacity: 1 !important;
    transform: scale(1) !important;
    pointer-events: auto !important;
    transition-delay: 0.08s;
}

/* Mobile active positions */
@media (max-width: 767px) {
    #support-hub-menu.active .hub-btn-whatsapp {
        bottom: 64px !important;
        transition-delay: 0.04s;
    }
    
    #support-hub-menu.active .hub-btn-ai {
        bottom: 116px !important;
        transition-delay: 0.08s;
    }
}

/* Individual button styles */
.hub-btn-ai {
    background: #3790ff;
    color: #030816 !important;
}
.hub-btn-ai:hover {
    background: #5da2ff;
    transform: scale(1.08) !important;
}

.hub-btn-whatsapp {
    background: #25D366;
    color: #ffffff !important;
}
.hub-btn-whatsapp:hover {
    background: #20ba5a;
    transform: scale(1.08) !important;
}

/* Force identical size and circular layout overriding global wa.me overrides */
#support-hub-menu .hub-btn-whatsapp {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
}

@media (max-width: 767px) {
    #support-hub-menu .hub-btn-whatsapp {
        width: 40px !important;
        height: 40px !important;
    }
}

/* Tooltips */
.hub-tooltip {
    position: absolute;
    right: 56px;
    background: #131B2F;
    color: #f8fafc;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(10px);
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

html:not(.dark) .hub-tooltip {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.hub-menu-btn:hover .hub-tooltip {
    opacity: 1;
    transform: translateX(0);
}

@media (max-width: 767px) {
    .hub-tooltip {
        display: none !important;
    }
}

/* Quick action buttons */
.ai-chat-quick-btn {
    display: inline-block;
    background: rgba(55,144,255, 0.1);
    color: #3790ff !important;
    border: 1px solid rgba(55,144,255, 0.3) !important;
    padding: 6px 12px !important;
    margin: 4px 4px !important;
    border-radius: 100px !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
html:not(.dark) .ai-chat-quick-btn {
    background: rgba(55, 144, 255, 0.08);
    color: #3790ff !important;
    border-color: rgba(55, 144, 255, 0.2) !important;
}
.ai-chat-quick-btn:hover {
    background: #3790ff !important;
    color: #030816 !important;
    border-color: #3790ff !important;
    transform: translateY(-1px) !important;
}
html:not(.dark) .ai-chat-quick-btn:hover {
    background: #3790ff !important;
    color: #ffffff !important;
    border-color: #3790ff !important;
}

/* Welcome Dropdown Styles */
.ai-chat-dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 180px;
    background: rgba(55, 144, 255, 0.08) !important;
    color: #3790ff !important;
    border: 1px solid rgba(55, 144, 255, 0.35) !important;
    padding: 8px 14px !important;
    margin: 10px 0 2px 0 !important;
    border-radius: 12px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.25s ease !important;
    outline: none !important;
}
html:not(.dark) .ai-chat-dropdown-btn {
    background: rgba(55, 144, 255, 0.05) !important;
    border-color: rgba(55, 144, 255, 0.2) !important;
}
.ai-chat-dropdown-btn:hover {
    background: #3790ff !important;
    color: #030816 !important;
    border-color: #3790ff !important;
    transform: translateY(-1px) !important;
}
html:not(.dark) .ai-chat-dropdown-btn:hover {
    color: #ffffff !important;
}
.ai-chat-dropdown-btn .dropdown-arrow {
    display: inline-block;
    font-size: 8px;
    margin-left: 8px;
    transition: transform 0.2s ease !important;
}
.ai-chat-dropdown-btn.active .dropdown-arrow {
    transform: rotate(180deg) !important;
}
.ai-chat-dropdown-content {
    display: none;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.25s ease !important;
}
.ai-chat-dropdown-content.show {
    display: block;
    opacity: 1;
}

/* Telemetry Badges & Sender tags */
.ai-sender-tag {
    display: block;
    font-size: 8px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.8px;
    margin-bottom: 4px;
    opacity: 0.7;
}
.ai-chat-msg.agent.admin {
    background: rgba(55, 144, 255, 0.1) !important;
    border-color: rgba(55, 144, 255, 0.2) !important;
    color: #3790ff !important;
}
html:not(.dark) .ai-chat-msg.agent.admin {
    background: #e0f2fe !important;
    border-color: #bae6fd !important;
    color: #0369a1 !important;
}

.ai-mode-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 6px;
}
.ai-mode-badge.ai-connected {
    background: rgba(55, 144, 255, 0.12);
    color: #3790ff;
}
.ai-mode-badge.human-connected {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}
.ai-mode-badge.hybrid-connected {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}
