/* CodLab AI Cable Advisor - Chatbot Widget */

.clai-chatbot {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* FAB Button — Animated */
.clai-fab {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: #0B0B0F;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    color: #FFED00;
    overflow: visible;
    animation: fabEntrance 0.6s 1s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes fabEntrance {
    from { opacity: 0; transform: scale(0.5) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.clai-fab::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 18px;
    background: conic-gradient(from 0deg, #FFED00, transparent 40%, transparent 60%, #FFED00);
    opacity: 0;
    z-index: -1;
    animation: fabGlow 3s linear infinite;
    transition: opacity 0.3s;
}

.clai-fab:hover::before { opacity: 1; }

@keyframes fabGlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.clai-fab:hover {
    background: #FFED00;
    color: #0B0B0F;
    transform: scale(1.05);
    box-shadow: 0 8px 32px rgba(255,237,0,0.25);
    border-radius: 16px;
}

.clai-fab-icon, .clai-fab-close {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.clai-fab:hover .clai-fab-icon { transform: scale(1.1); }

.clai-fab-close { display: none; }
.clai-chatbot.open .clai-fab-icon { display: none; }
.clai-chatbot.open .clai-fab-close { display: block; }
.clai-chatbot.open .clai-fab {
    background: #1A1A22;
    color: #78788A;
    border-radius: 50%;
}
.clai-chatbot.open .clai-fab:hover {
    color: #fff;
    background: #28283A;
}
.clai-chatbot.open .clai-fab::before { display: none; }

.clai-fab-pulse {
    position: absolute;
    inset: -6px;
    border-radius: 20px;
    border: none;
    background: rgba(255,237,0,0.08);
    animation: clai-pulse 2.5s ease infinite;
    pointer-events: none;
}

.clai-chatbot.open .clai-fab-pulse { display: none; }

/* Chat Window */
.clai-window {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 400px;
    max-height: 600px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transition: all 0.3s ease;
    overflow: hidden;
}

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

/* Header */
.clai-header {
    background: linear-gradient(135deg, #0A0A0A, #1A1A1A);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.clai-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #FFED00;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0B0B0F;
}


.clai-header-title {
    color: #fff;
    font-weight: 600;
    font-size: 0.9375rem;
}

.clai-header-status {
    font-size: 0.6875rem;
    color: #22C55E;
}

.clai-minimize {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}
.clai-minimize:hover { color: #fff; background: rgba(255,255,255,0.1); }

/* Messages */
.clai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 300px;
    max-height: 380px;
}

.clai-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.8125rem;
    line-height: 1.6;
    animation: clai-fadeIn 0.3s ease;
}

@keyframes clai-fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.clai-msg-bot {
    align-self: flex-start;
    background: #f5f5f5;
    color: #333;
    border-bottom-left-radius: 4px;
}

.clai-msg-user {
    align-self: flex-end;
    background: #0A0A0A;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.clai-msg-bot strong { color: #0B0B0F; font-weight: 600; }

.clai-msg-bot ul, .clai-msg-bot ol {
    margin: 8px 0;
    padding-left: 18px;
}

.clai-msg-bot li { margin-bottom: 4px; }

.clai-msg-bot a {
    color: #0B0B0F; font-weight: 600; text-decoration: underline;
    text-decoration: underline;
}

.clai-msg-bot code {
    background: rgba(0,0,0,0.05);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.75rem;
}

/* Typing indicator */
.clai-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 14px;
    background: #f5f5f5;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    width: fit-content;
}

.clai-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #0B0B0F;
    animation: clai-typing 1.4s ease infinite;
}

.clai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.clai-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes clai-typing {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
}

/* Quick Actions */
.clai-quick-actions {
    padding: 8px 16px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    border-top: 1px solid #f0f0f0;
}

.clai-quick-btn {
    padding: 4px 10px;
    font-size: 0.6875rem;
    background: rgba(255,237,0,0.06);
    border: 1px solid rgba(255, 237, 0, 0.15);
    border-radius: 100px;
    cursor: pointer;
    color: #0B0B0F;
    font-weight: 500;
    transition: all 0.2s;
    font-family: inherit;
}

.clai-quick-btn:hover {
    background: #0B0B0F;
    color: #fff;
    border-color: #0B0B0F;
}

/* Input */
.clai-input {
    display: flex;
    padding: 12px 16px;
    gap: 8px;
    border-top: 1px solid #f0f0f0;
}

.clai-input input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.8125rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.clai-input input:focus {
    border-color: #0B0B0F;
}

.clai-input button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: #0A0A0A;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.clai-input button:hover { background: #0B0B0F; color: #0B0B0F; }

/* Footer */
.clai-footer {
    text-align: center;
    padding: 6px;
    font-size: 0.625rem;
    color: #bbb;
}

.clai-footer a {
    color: #0B0B0F; font-weight: 600;
    text-decoration: none;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 480px) {
    .clai-window {
        width: calc(100vw - 32px);
        right: -8px;
        bottom: 64px;
        max-height: calc(100vh - 100px);
    }

    .clai-chatbot {
        bottom: 16px;
        right: 16px;
    }
}
