/* ============================
   BlackOptic GPT Chat Widget
   ============================ */

/* ---------- Floating Button ---------- */
#bo-chat-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #facd01;
    border: 2px solid #facd01;
    box-shadow: 0 4px 15px rgba(250, 205, 1, 0.4);
    cursor: pointer;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    padding: 0;
}

#bo-chat-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 25px rgba(250, 205, 1, 0.25);
}

#bo-chat-btn .chat-icon {
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

#bo-chat-btn .close-icon {
    display: none;
    width: 24px;
    height: 24px;
    color: #000;
}

#bo-chat-btn.active .chat-icon { display: none; }
#bo-chat-btn.active .close-icon { display: block; }

/* Pulse ring */
#bo-chat-btn::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(250, 205, 1, 0.15);
    animation: bo-pulse 2s ease-in-out infinite;
    z-index: -1;
}

@keyframes bo-pulse {
    0% { transform: scale(1); opacity: 0.6; }
    70% { transform: scale(1.5); opacity: 0; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* ---------- Chat Panel ---------- */
#bo-chat-panel {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 140px);
    background: #1a1a2e;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    z-index: 99998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(250, 205, 1, 0.15);
    animation: bo-slide-up 0.3s ease;
}

#bo-chat-panel.open {
    display: flex;
}

@keyframes bo-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Header ---------- */
#bo-chat-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(250, 205, 1, 0.2);
    flex-shrink: 0;
}

#bo-chat-header .bot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

#bo-chat-header .bot-avatar img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

#bo-chat-header .bot-info {
    flex: 1;
    min-width: 0;
}

#bo-chat-header .bot-name {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}

#bo-chat-header .bot-status {
    color: #4ade80;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

#bo-chat-header .bot-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
    animation: bo-blink 1.5s ease-in-out infinite;
}

@keyframes bo-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

#bo-chat-header #bo-chat-close {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#bo-chat-header #bo-chat-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* ---------- Messages Area ---------- */
#bo-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #0f0f1a;
}

#bo-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#bo-chat-messages::-webkit-scrollbar { width: 4px; }
#bo-chat-messages::-webkit-scrollbar-track { background: transparent; }
#bo-chat-messages::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }
#bo-chat-messages::-webkit-scrollbar-thumb:hover { background: #555; }

/* Message bubbles */
.bo-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: bo-fade-in 0.3s ease;
}

@keyframes bo-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.bo-message.bot {
    align-self: flex-start;
    background: #1e1e36;
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.bo-message.user {
    align-self: flex-end;
    background: #facd01;
    color: #000;
    border-bottom-right-radius: 4px;
}

.bo-message.bot strong {
    color: #facd01;
}

.bo-message.bot ul {
    margin: 6px 0;
    padding-left: 20px;
}

.bo-message.bot li {
    margin-bottom: 4px;
}

/* ---------- Typing Indicator ---------- */
#bo-typing {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 0 16px 12px;
    background: transparent;
}

#bo-typing.active {
    display: flex;
}

#bo-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #888;
    display: inline-block;
    animation: bo-bounce 1.2s ease-in-out infinite;
}

#bo-typing span:nth-child(2) { animation-delay: 0.2s; }
#bo-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bo-bounce {
    0%, 60%, 100% { transform: translateY(0); background: #888; }
    30% { transform: translateY(-6px); background: #facd01; }
}

/* ---------- Input Area ---------- */
#bo-chat-input-area {
    padding: 12px 16px;
    background: #1a1a2e;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
}

#bo-chat-input {
    flex: 1;
    background: #252542;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 14px;
    color: #fff;
    font-size: 14px;
    resize: none;
    outline: none;
    min-height: 20px;
    max-height: 100px;
    line-height: 1.4;
    font-family: inherit;
}

#bo-chat-input::placeholder {
    color: #666;
}

#bo-chat-input:focus {
    border-color: rgba(250, 205, 1, 0.4);
}

#bo-chat-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #facd01;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

#bo-chat-send:hover {
    background: #e6b800;
    transform: scale(1.05);
}

#bo-chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

#bo-chat-send svg {
    width: 18px;
    height: 18px;
    color: #000;
    margin-left: 2px;
}

/* ---------- Welcome Message ---------- */
.bo-welcome {
    text-align: center;
    padding: 30px 20px;
    color: #888;
}

.bo-welcome .welcome-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: rgba(250, 205, 1, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bo-welcome .welcome-icon svg {
    width: 30px;
    height: 30px;
    color: #facd01;
}

.bo-welcome h4 {
    color: #fff;
    font-size: 16px;
    margin: 0 0 8px;
}

.bo-welcome p {
    font-size: 13px;
    margin: 0;
    line-height: 1.5;
}

/* ---------- Error message ---------- */
.bo-message.error {
    align-self: center;
    background: rgba(255, 50, 50, 0.1);
    color: #ff6b6b;
    border: 1px solid rgba(255, 50, 50, 0.2);
    font-size: 13px;
    text-align: center;
    max-width: 90%;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    #bo-chat-btn {
        bottom: 20px;
        right: 20px;
        width: 52px;
        height: 52px;
    }

    #bo-chat-btn .chat-icon {
        width: 38px;
        height: 38px;
    }

    #bo-chat-panel {
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
}
