/* Chatbot Variables */
:root {
    --cb-primary: #135bec;
    --cb-bg: #0a0c10;
    --cb-surface: #161b22;
    --cb-border: rgba(255, 255, 255, 0.1);
    --cb-text: #ffffff;
    --cb-text-muted: #9ca3af;
}

/* Widget Container */
#chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

/* Floating Toggle Button */
#chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--cb-primary);
    border: none;
    box-shadow: 0 4px 12px rgba(19, 91, 236, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#chatbot-toggle:hover {
    transform: scale(1.1);
}

#chatbot-toggle svg {
    width: 32px;
    height: 32px;
    fill: white;
}

/* Chat Window */
#chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: var(--cb-bg);
    border: 1px solid var(--cb-border);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.3s ease;

    /* Hidden State */
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
}

#chatbot-window.active {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* Header */
.cb-header {
    background: var(--cb-primary);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cb-title {
    font-weight: bold;
    font-size: 16px;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cb-status {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
}

.cb-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
}

.cb-close:hover {
    color: white;
}

/* Content Area */
.cb-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--cb-surface);
    position: relative;
}

/* Messages */
.cb-message {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    max-width: 85%;
}

.cb-message.bot {
    background: rgba(255, 255, 255, 0.05);
    color: var(--cb-text);
    border-bottom-left-radius: 2px;
    align-self: flex-start;
}

.cb-message.user {
    background: var(--cb-primary);
    color: white;
    border-bottom-right-radius: 2px;
    margin-left: auto;
}

/* Input Area */
.cb-input-area {
    padding: 12px;
    background: var(--cb-bg);
    border-top: 1px solid var(--cb-border);
    display: flex;
    gap: 8px;
}

.cb-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--cb-border);
    border-radius: 20px;
    padding: 8px 16px;
    color: white;
    font-size: 14px;
    outline: none;
    color: white !important;
    caret-color: white !important;
    /* Force white text */
    background: #161b22 !important;
    /* Force dark background */
}

/* Autofill fix */
.cb-input:-webkit-autofill,
.cb-input:-webkit-autofill:hover,
.cb-input:-webkit-autofill:focus {
    -webkit-text-fill-color: white;
    -webkit-box-shadow: 0 0 0px 1000px #161b22 inset;
    background-color: #161b22 !important;
    transition: background-color 5000s ease-in-out 0s;
}

.cb-input:focus {
    border-color: var(--cb-primary);
}

.cb-send {
    background: var(--cb-primary);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Lead Capture Form */
#cb-lead-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    justify-content: center;
}

.cb-form-title {
    text-align: center;
    font-weight: bold;
    margin-bottom: 12px;
}

.cb-form-input {
    background: var(--cb-bg);
    border: 1px solid var(--cb-border);
    padding: 12px;
    border-radius: 8px;
    caret-color: white !important;
    color: white !important;
    background: #0a0c10 !important;
}

.cb-form-input:-webkit-autofill,
.cb-form-input:-webkit-autofill:hover,
.cb-form-input:-webkit-autofill:focus {
    -webkit-text-fill-color: white;
    -webkit-box-shadow: 0 0 0px 1000px #0a0c10 inset;
    background-color: #0a0c10 !important;
    transition: background-color 5000s ease-in-out 0s;
}

.cb-form-btn {
    background: var(--cb-primary);
    color: white;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.cb-form-btn:hover {
    background: #2563eb;
}

/* Popup Message */
#cb-popup {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 200px;
    background: white;
    color: black;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-size: 13px;
    font-weight: bold;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
    pointer-events: none;
}

#cb-popup.show {
    opacity: 1;
    transform: translateY(0);
}

#cb-popup::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 24px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    #chatbot-window {
        width: calc(100vw - 40px);
        bottom: 80px;
        right: 0;
        height: 60vh;
    }
}