/* css/chat.css - Styling for the Infowise AI Widget */

.chat-widget-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

/* Toggle Button */
.chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--secondary, #f58220);
    color: #fff;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(245, 130, 32, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.chat-toggle-btn:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 8px 25px rgba(245, 130, 32, 0.6);
}

.chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--secondary, #f58220);
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    max-height: 80vh;
    background: rgba(10, 15, 25, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.chat-header {
    padding: 1rem;
    background: rgba(0,0,0,0.4);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s;
}

.chat-close-btn:hover {
    color: #ef4444;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.5); }
    100% { opacity: 1; transform: scale(1); }
}

/* Body / Message Area */
.chat-body {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.chat-body::-webkit-scrollbar {
    width: 6px;
}
.chat-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

/* Messages */
.chat-message {
    display: flex;
    width: 100%;
}

.ai-message {
    justify-content: flex-start;
}

.user-message {
    justify-content: flex-end;
}

.msg-bubble {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.ai-message .msg-bubble {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #e2e8f0;
    border-bottom-left-radius: 2px;
}

.user-message .msg-bubble {
    background: var(--store-primary, #38bdf8);
    color: #000;
    border-bottom-right-radius: 2px;
    font-weight: 500;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.5rem;
    align-items: center;
}

.typing-dot {
    width: 5px;
    height: 5px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Footer / Input */
.chat-footer {
    padding: 1rem;
    background: rgba(0,0,0,0.6);
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    gap: 0.5rem;
}

.chat-footer input {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 20px;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: border-color 0.3s;
}

.chat-footer input:focus {
    border-color: var(--store-primary, #38bdf8);
}

.chat-footer button {
    background: var(--store-primary, #38bdf8);
    color: #000;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-footer button:hover {
    transform: scale(1.1);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chat-widget-container {
        bottom: 1rem;
        right: 1rem;
    }
    
    .chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
        z-index: 10000;
    }
    
    .chat-window.active {
        transform: translateY(0) scale(1);
    }
}
