/* === CHAT WIDGET — PROFESSIONAL === */

.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    font-family: 'Be Vietnam Pro', sans-serif;
}

.chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #0f7b6c;
    border: none;
    box-shadow: 0 4px 16px rgba(15, 123, 108, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: white;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(15, 123, 108, 0.45);
}

.chat-container {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 380px;
    max-height: 520px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e9ecef;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    pointer-events: none;
    transition: all 0.25s ease;
}

.chat-container.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.chat-header {
    background: #0f7b6c;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.chat-info h3 {
    color: white;
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
}

.chat-info p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-expand {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 4px;
}

.chat-expand:hover {
    color: white;
}

.chat-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.3rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 4px;
    margin-left: 0.25rem;
}

.chat-close:hover {
    color: white;
}

/* === EXPANDED MODE === */
.chat-container.expanded {
    width: 600px;
    max-height: 80vh;
    bottom: 72px;
}

.chat-container.expanded .chat-messages {
    min-height: 400px;
}

.chat-container.expanded .message {
    font-size: 1rem;
    padding: 0.85rem 1.15rem;
}

.chat-container.expanded .chat-input {
    font-size: 1rem;
    padding: 0.8rem 1.15rem;
}

/* === STATUS DOT === */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #888;
    flex-shrink: 0;
}

.status-dot.online {
    background: #4ade80;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
    animation: statusPulse 2s ease-in-out infinite;
}

.status-dot.offline {
    background: #f87171;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === MESSAGES === */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #f8f9fa;
}

.message {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.6;
    animation: messageSlide 0.25s ease-out;
    white-space: pre-wrap;
    word-wrap: break-word;
}

@keyframes messageSlide {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.coyote {
    background: #0f7b6c;
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.user {
    background: #1a1a2e;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* === STREAMING CURSOR === */
.message.streaming::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1em;
    background: white;
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursorBlink 0.6s step-end infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* === TYPING INDICATOR === */
.message.typing {
    background: #e9ecef;
    align-self: flex-start;
    padding: 0.75rem 1.25rem;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    background: #6c757d;
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* === INPUT AREA === */
.chat-input-area {
    padding: 0.75rem 1rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 0.5rem;
    background: #ffffff;
}

.chat-input {
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 24px;
    padding: 0.7rem 1rem;
    color: #333;
    font-size: 0.9rem;
    font-family: 'Be Vietnam Pro', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input::placeholder {
    color: #6c757d;
}

.chat-input:focus {
    border-color: #0f7b6c;
}

.chat-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #0f7b6c;
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-send:hover {
    background: #0a6359;
}

/* === MOBILE === */
@media (max-width: 768px) {
    .chat-widget {
        bottom: 16px;
        right: 16px;
    }

    .chat-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.4rem;
    }

    .chat-container {
        width: calc(100vw - 32px);
        max-height: 70vh;
        right: -8px;
        bottom: 64px;
    }

    .chat-container.expanded {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
}
