/* ═══════════════════════════════════════
   AI Chat Widget Styles
   ═══════════════════════════════════════ */

#aiChatWidget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'IBM Plex Sans Thai', 'Inter', -apple-system, sans-serif;
}

/* Toggle Button */
#chatToggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #C62828;
    border: none;
    box-shadow: 0 4px 20px rgba(198, 40, 40, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

#chatToggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(198, 40, 40, 0.5);
}

/* Chat Window */
#chatWindow {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 360px;
    height: 520px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#chatWindow.chat-hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

#chatWindow.chat-open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

@media(max-width:480px) {
    #chatWindow {
        width: calc(100vw - 16px);
        height: calc(100vh - 100px);
        bottom: 8px;
        right: 8px;
        border-radius: 16px;
    }
}

/* Header */
.chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #C62828;
    color: #fff;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.2);
}

.chat-header strong {
    font-size: 0.95rem;
    display: block;
}

.chat-header small {
    font-size: 0.75rem;
    opacity: 0.8;
}

#chatClose {
    margin-left: auto;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}

#chatClose:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Body */
.chat-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Messages */
.chat-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
}

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

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

/* Typing indicator */
.chat-typing {
    display: none;
    gap: 4px;
    padding: 8px 16px;
    align-items: center;
}

.chat-typing span {
    width: 8px;
    height: 8px;
    background: #ccc;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

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

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

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-8px);
    }
}

/* Input bar */
.chat-input-bar {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #eee;
}

.chat-input-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
}

.chat-input-bar input:focus {
    border-color: #C62828;
}

#chatSend {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #C62828;
    color: #fff;
    font-size: 1.2rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chatSend:hover {
    background: #8E0000;
}

/* Suggestions */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.chat-suggestions button {
    background: #fff;
    border: 1px solid #C62828;
    color: #C62828;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    transition: 0.2s;
}

.chat-suggestions button:hover {
    background: #C62828;
    color: #fff;
}