/* 
   GeniusBot Stylesheet
   Wealth Genius AI Chatbot Widget Styling
*/

:root {
    --cb-primary: #043B1C;
    --cb-primary-light: #279C5C;
    --cb-gradient: linear-gradient(135deg, #043B1C 0%, #279C5C 100%);
    --cb-user-gradient: linear-gradient(135deg, #279C5C 0%, #175F36 100%);
    --cb-bg-light: #F4FAF6;
    --cb-border-color: #E2EFE7;
    --cb-shadow: 0 10px 30px rgba(4, 59, 28, 0.15);
    --cb-text-dark: #333333;
    --cb-text-muted: #666666;
    --cb-font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Chat Launcher Button */
.chatbot-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--cb-gradient);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(4, 59, 28, 0.3);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    outline: none;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.chatbot-launcher:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 6px 20px rgba(4, 59, 28, 0.45);
}

.chatbot-launcher svg {
    width: 28px;
    height: 28px;
    fill: #ffffff;
    transition: transform 0.3s ease;
}

.chatbot-launcher.active svg {
    transform: rotate(90deg);
}

/* Pulse animation for launcher */
.chatbot-launcher::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--cb-primary-light);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.4;
    animation: cb-pulse 2s infinite;
}

@keyframes cb-pulse {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }

    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* Chat Window Container */
.chatbot-window {
    position: fixed;
    bottom: 105px;
    right: 30px;
    width: 450px;
    height: 70vh;
    max-height: calc(100vh - 130px);
    /* Prevent overflow into header on small screens */
    background: #ffffff;
    border-radius: 16px;
    box-shadow: var(--cb-shadow);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease, visibility 0.3s;
    font-family: var(--cb-font);
}

.chatbot-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chatbot-header {
    background: var(--cb-gradient);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.chatbot-avatar svg {
    width: 22px;
    height: 22px;
    fill: #ffffff;
}

.chatbot-status-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: #2ECC71;
    border: 2px solid #043B1C;
    border-radius: 50%;
    animation: cb-blink 1.5s infinite;
}

@keyframes cb-blink {
    0% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.4;
    }
}

.chatbot-details h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #ffffff;
}

.chatbot-details span {
    font-size: 11px;
    opacity: 0.85;
    display: block;
}

.chatbot-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-btn-close {
    background: none;
    border: none;
    color: #ffffff;
    opacity: 0.7;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s, transform 0.2s;
    outline: none;
}

.chatbot-btn-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Chat Body */
.chatbot-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar for Chat Body */
.chatbot-body::-webkit-scrollbar {
    width: 6px;
}

.chatbot-body::-webkit-scrollbar-track {
    background: #f9f9f9;
}

.chatbot-body::-webkit-scrollbar-thumb {
    background: #d4e8dd;
    border-radius: 4px;
}

.chatbot-body::-webkit-scrollbar-thumb:hover {
    background: #b5d8c3;
}

/* Message Bubble Rules */
.cb-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: cb-fade-in-up 0.3s ease forwards;
}

@keyframes cb-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cb-message.user {
    align-self: flex-end;
}

.cb-message.bot {
    align-self: flex-start;
}

.cb-msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}

.cb-message.user .cb-msg-bubble {
    background: var(--cb-user-gradient);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 3px 10px rgba(39, 156, 92, 0.15);
}

.cb-message.bot .cb-msg-bubble {
    background: var(--cb-bg-light);
    color: var(--cb-text-dark);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--cb-border-color);
}

/* Style formatting inside responses */
.cb-msg-bubble p {
    margin: 0 0 10px 0;
}

.cb-msg-bubble p:last-child {
    margin-bottom: 0;
}

.cb-msg-bubble ul,
.cb-msg-bubble ol {
    margin: 0 0 10px 0;
    padding-left: 20px;
}

.cb-msg-bubble ul:last-child,
.cb-msg-bubble ol:last-child {
    margin-bottom: 0;
}

.cb-msg-bubble li {
    margin-bottom: 4px;
}

.cb-msg-bubble a {
    color: #175F36;
    text-decoration: underline;
    font-weight: 600;
}

.cb-msg-bubble a:hover {
    color: #279C5C;
}

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

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

.cb-message.bot .cb-msg-time {
    align-self: flex-start;
}

/* Quick FAQs / Suggested Actions Container */
.chatbot-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 5px;
    margin-bottom: 5px;
    animation: cb-fade-in-up 0.4s ease forwards;
}

.chatbot-suggestions-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--cb-text-muted);
    margin-bottom: 4px;
}

.cb-suggest-btn {
    background: #ffffff;
    border: 1px solid var(--cb-primary-light);
    color: var(--cb-primary);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--cb-font);
    outline: none;
}

.cb-suggest-btn:hover {
    background: var(--cb-primary-light);
    color: #ffffff;
    transform: translateX(3px);
}

/* Bouncing Typing Animation */
.cb-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

.cb-typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--cb-primary-light);
    border-radius: 50%;
    animation: cb-typing-bounce 1.4s infinite ease-in-out both;
}

.cb-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.cb-typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes cb-typing-bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Chat Footer (Input area) */
.chatbot-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--cb-border-color);
    background: #ffffff;
}

.chatbot-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--cb-border-color);
    border-radius: 24px;
    padding: 4px 8px 4px 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #FAFDFB;
}

.chatbot-input-container:focus-within {
    border-color: var(--cb-primary-light);
    box-shadow: 0 0 0 3px rgba(39, 156, 92, 0.1);
    background: #ffffff;
}

.chatbot-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13px;
    background: transparent;
    padding: 8px 0;
    color: var(--cb-text-dark);
    font-family: var(--cb-font);
}

.chatbot-input::placeholder {
    color: #A0B2A6;
}

.chatbot-btn-send {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--cb-gradient);
    border: none;
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    flex-shrink: 0;
}

.chatbot-btn-send:hover {
    transform: scale(1.05);
}

.chatbot-btn-send:active {
    transform: scale(0.95);
}

.chatbot-btn-send svg {
    width: 14px;
    height: 14px;
    fill: #ffffff;
    margin-left: 2px;
}

.chatbot-btn-send:disabled {
    background: #E0E7E3;
    cursor: not-allowed;
    transform: none;
}

.chatbot-disclaimer {
    font-size: 9px;
    color: var(--cb-text-muted);
    text-align: center;
    line-height: 1.3;
    margin-top: 8px;
    padding: 0 4px;
}

/* Responsive styles */
@media (max-width: 768px) {
    .chatbot-launcher {
        bottom: 75px;
        /* Offset above the sticky booking bar at bottom:0 */
        right: 20px;
        width: 54px;
        height: 54px;
    }

    .chatbot-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        z-index: 10002;
        /* Float above everything including navigation menu */
        transform: translateY(100%);
    }

    .chatbot-window.open {
        transform: translateY(0);
    }

    .chatbot-header {
        padding: 12px 16px;
    }
}

/* Small height screens: laptops with short viewports */
@media (max-height: 750px) and (min-width: 769px) {
    .chatbot-window {
        top: 90px;
        /* stay below the website header */
        bottom: 100px;
        /* stay above the launcher button */
        height: auto;
        /* fill the space between top and bottom */
        max-height: none;
    }
}