:root {
    --be-primary: #27fff7;
    --be-secondary: #acffb5;
    --be-bg-dark: #1a1a1a;
    --be-bg-darker: #111111;
    --be-bg-light: #2a2a2a;
    --be-text-main: #ffffff;
    --be-text-muted: #b0b0b0;
    --be-text-inverse: #000000;
    --be-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --be-radius: 20px;
    --be-radius-sm: 12px;
}

/* Chatbot Container */
#blacki-chatbot-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: auto;
    z-index: 9999;
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Toggle Button */
#blacki-chatbot-toggle {
    background: linear-gradient(135deg, var(--be-primary), var(--be-secondary));
    color: var(--be-text-inverse);
    border: none;
    border-radius: 30px;
    height: 60px;
    padding: 0 25px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(39, 255, 247, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    gap: 12px;
    position: absolute;
    bottom: 0;
    left: 0;
    right: auto;
    z-index: 10;
    width: auto;
    min-width: 140px;
    opacity: 1;
    transform: scale(1);
    font-weight: 700;
    letter-spacing: 0.5px;
}

#blacki-chatbot-toggle:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(39, 255, 247, 0.6);
}

/* Hide button when chat is open */
#blacki-chatbot-container.active #blacki-chatbot-toggle {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
}

#blacki-chatbot-toggle img {
    width: 28px;
    height: auto;
    filter: brightness(0); /* Make icon black to fit the bright background */
}

.blacki-toggle-label {
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
}

/* Chat Window */
#blacki-chat-window {
    display: flex;
    position: absolute;
    bottom: 0;
    left: 0;
    right: auto;
    width: 450px;
    height: 720px;
    background-color: var(--be-bg-dark);
    border-radius: var(--be-radius);
    box-shadow: var(--be-shadow);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    
    /* Animation */
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    transform-origin: bottom left;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    pointer-events: none;
}

#blacki-chat-window.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Header */
.blacki-chat-header {
    background: rgba(30, 30, 30, 0.95);
    color: var(--be-text-main);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.blacki-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.blacki-chat-header-info img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--be-primary);
    padding: 2px;
    background: var(--be-bg-darker);
}

.blacki-chat-header-title {
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
}

.blacki-chat-header-title span {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--be-text-muted);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.blacki-chat-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.blacki-chat-close, .blacki-chat-delete {
    background: transparent;
    border: none;
    color: var(--be-text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blacki-chat-delete {
    font-size: 18px; /* Slightly smaller icon */
}

.blacki-chat-close:hover, .blacki-chat-delete:hover {
    color: var(--be-primary);
    background: rgba(255,255,255,0.05);
}

/* Messages Area */
.blacki-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: var(--be-bg-dark);
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

/* Custom Scrollbar */
.blacki-chat-messages::-webkit-scrollbar {
    width: 6px;
}
.blacki-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.blacki-chat-messages::-webkit-scrollbar-thumb {
    background-color: #333;
    border-radius: 10px;
}

.blacki-message {
    max-width: 85%;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
}

.blacki-message.bot {
    align-self: flex-start;
    background-color: var(--be-bg-light);
    color: var(--be-text-main);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.blacki-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--be-primary), var(--be-secondary));
    color: var(--be-text-inverse);
    border-bottom-right-radius: 4px;
    font-weight: 500;
    box-shadow: 0 4px 10px rgba(39, 255, 247, 0.2);
}

/* Pre-questions Chips */
.blacki-pre-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 5px;
}
.blacki-chip {
    background-color: transparent;
    border: 1px solid var(--be-primary);
    color: var(--be-primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}
.blacki-chip:hover {
    background-color: var(--be-primary);
    color: var(--be-text-inverse);
    box-shadow: 0 0 10px rgba(39, 255, 247, 0.4);
}

/* Actions Bar */
.blacki-chat-actions {
    display: flex;
    justify-content: space-around;
    padding: 10px 15px;
    background: var(--be-bg-darker);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.blacki-chat-actions button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--be-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.blacki-chat-actions button:hover {
    background-color: rgba(39, 255, 247, 0.1);
    color: var(--be-primary);
    border-color: rgba(39, 255, 247, 0.3);
}

/* Input Area */
.blacki-chat-input-area {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background-color: var(--be-bg-darker);
    display: flex;
    gap: 12px;
    align-items: center;
}

#blacki-chat-input {
    flex: 1;
    padding: 12px 15px;
    background-color: var(--be-bg-light);
    border: 1px solid transparent;
    color: var(--be-text-main);
    border-radius: 25px;
    outline: none;
    font-size: 16px; /* 16px prevents iOS zoom on focus */
    transition: all 0.2s;
}

#blacki-chat-input:focus {
    border-color: var(--be-primary);
    background-color: #333;
}

#blacki-chat-input::placeholder {
    color: #666;
}

#blacki-chat-send {
    background: linear-gradient(135deg, var(--be-primary), var(--be-secondary));
    color: var(--be-text-inverse);
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    box-shadow: 0 0 10px rgba(39, 255, 247, 0.3);
}

#blacki-chat-send:hover {
    transform: scale(1.1);
}

#blacki-chat-send svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Footer Contact */
.blacki-chat-footer {
    padding: 8px;
    background: var(--be-bg-darker);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 10px;
    text-align: center;
    color: #555;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.blacki-chat-footer a {
    color: #777;
    text-decoration: none;
}
.blacki-chat-footer a:hover {
    color: var(--be-primary);
}

/* Typing Indicator */
.blacki-typing {
    display: flex;
    gap: 5px;
    padding: 15px;
    background-color: var(--be-bg-light);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    width: fit-content;
}

.blacki-dot {
    width: 6px;
    height: 6px;
    background-color: var(--be-primary);
    border-radius: 50%;
    animation: blacki-bounce 1.4s infinite ease-in-out both;
}

.blacki-dot:nth-child(1) { animation-delay: -0.32s; }
.blacki-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes blacki-bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Mobile Responsiveness */
@media screen and (max-width: 768px) {
    #blacki-chatbot-container {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 0;
        pointer-events: none;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        position: fixed;
        z-index: 99999;
    }
    
    #blacki-chatbot-container.active {
        height: 100%;
        pointer-events: auto;
        background-color: rgba(0,0,0,0.8);
    }

    #blacki-chatbot-toggle {
        pointer-events: auto;
        bottom: 20px;
        right: 20px;
        box-shadow: 0 4px 20px rgba(39, 255, 247, 0.5);
    }

    #blacki-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        height: 100dvh;
        border-radius: 0;
        border: none;
        box-shadow: none;
        display: flex;
        flex-direction: column;
        margin: 0;
        max-width: none;
    }
    
    .blacki-chat-header {
        padding: 15px;
        padding-top: max(15px, env(safe-area-inset-top));
    }

    .blacki-chat-messages {
        flex: 1;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    .blacki-chat-actions {
        padding: 10px;
        gap: 10px;
    }

    .blacki-chat-actions button {
        flex: 1;
        justify-content: center;
        padding: 12px;
        font-size: 14px;
        background-color: rgba(255,255,255,0.08);
    }
    
    .blacki-chat-input-area {
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }

    .blacki-message {
        font-size: 16px;
    }
    
    #blacki-chat-input {
        font-size: 16px;
        height: 48px;
    }
}