/* ═══════════════════════════════════════════
   UniDav Chatbot – Frontend Chat Widget
   ═══════════════════════════════════════════ */

#unidav-chat-bubble {
    position: fixed;
    bottom: 24px;
    z-index: 99999;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 28px rgba(0,0,0,0.25);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s;
    animation: unidav-pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#unidav-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 36px rgba(0,0,0,0.3);
}
#unidav-chat-bubble svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
#unidav-chat-bubble .unidav-close-icon { display: none; }
#unidav-chat-bubble.open .unidav-chat-icon { display: none; }
#unidav-chat-bubble.open .unidav-close-icon { display: block; }

/* Chat window */
#unidav-chat-window {
    position: fixed;
    bottom: 100px;
    z-index: 99998;
    width: 380px;
    height: 520px;
    border-radius: 20px;
    overflow: hidden;
    display: none;
    flex-direction: column;
    background: #0a0e17;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05);
    animation: unidav-slide-up 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}
#unidav-chat-window.open {
    display: flex;
}

/* Header */
.unidav-chat-header {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.unidav-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    backdrop-filter: blur(8px);
}
.unidav-chat-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.unidav-chat-status {
    font-size: 12px;
    color: rgba(255,255,255,0.65);
    display: flex;
    align-items: center;
    gap: 5px;
}
.unidav-chat-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    display: inline-block;
    animation: unidav-pulse 2s infinite;
}

/* Messages */
.unidav-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.unidav-chat-messages::-webkit-scrollbar { width: 4px; }
.unidav-chat-messages::-webkit-scrollbar-track { background: transparent; }
.unidav-chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.unidav-msg {
    max-width: 82%;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-wrap;
    animation: unidav-fade-in 0.3s ease;
}
.unidav-msg-bot {
    align-self: flex-start;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 16px 16px 16px 4px;
}
.unidav-msg-user {
    align-self: flex-end;
    color: #fff;
    border-radius: 16px 16px 4px 16px;
}

/* Typing indicator */
.unidav-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 12px 18px;
    background: #1e293b;
    border-radius: 16px 16px 16px 4px;
}
.unidav-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748b;
    animation: unidav-bounce 1.2s infinite;
}
.unidav-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.unidav-typing-dot:nth-child(3) { animation-delay: 0.3s; }

/* Input */
.unidav-chat-input {
    padding: 12px 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: #111827;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.unidav-chat-input input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: #1e293b;
    color: #e2e8f0;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}
.unidav-chat-input input:focus {
    border-color: var(--unidav-accent-color, #6366f1);
}
.unidav-chat-input input::placeholder {
    color: #64748b;
}
.unidav-chat-input button {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    color: #fff;
}
.unidav-chat-input button:disabled {
    background: #1e293b !important;
    color: #64748b;
    cursor: default;
}
.unidav-chat-input button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Powered by */
.unidav-powered {
    text-align: center;
    padding: 6px;
    font-size: 10px;
    color: #475569;
    background: #0d1117;
}

/* Animations */
@keyframes unidav-pop-in {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes unidav-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes unidav-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes unidav-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}
@keyframes unidav-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Mobile */
@media (max-width: 480px) {
    #unidav-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 140px);
        bottom: 90px;
        left: 10px !important;
        right: 10px !important;
        border-radius: 16px;
    }
}
