.ai-chat-btn {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #073692;
    color: #fff;
    border: none;
    box-shadow: 0 4px 20px rgba(7,54,146,0.4);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    font-size: 24px;
}
.ai-chat-btn:hover {
    transform: scale(1.1);
    background: #052a6e;
}

.ai-chat-widget {
    position: fixed;
    bottom: 160px;
    right: 20px;
    width: 360px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}
.ai-chat-widget.open { display: flex; }

.ai-chat-header {
    background: #073692;
    color: #fff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ai-chat-header h6 { margin: 0; font-weight: 600; font-size: 15px; flex: 1; }
.ai-chat-header .ai-status { width: 8px; height: 8px; border-radius: 50%; background: #4BB543; display: inline-block; }
.ai-chat-close { background: none; border: none; color: #fff; cursor: pointer; font-size: 18px; opacity: 0.8; }

/* Form step */
.ai-chat-form, .ai-chat-messages {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}
.ai-chat-form h6 { font-size: 14px; color: #333; margin-bottom: 14px; text-align: center; }
.ai-chat-form .form-control {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 10px;
}
.ai-chat-form .form-control:focus {
    border-color: #FFD700;
    box-shadow: 0 0 0 3px rgba(255,215,0,0.15);
}
.ai-chat-form .btn-chat-start {
    background: #073692;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    transition: 0.3s;
}
.ai-chat-form .btn-chat-start:hover { background: #052a6e; }

/* Messages */
.ai-chat-messages { display: none; flex-direction: column; gap: 10px; height: 340px; }
.ai-chat-messages.open { display: flex; }
.ai-chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    animation: msgIn 0.3s ease;
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.ai-chat-msg.bot {
    background: #f0f2f5;
    color: #222;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.ai-chat-msg.user {
    background: #073692;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.ai-chat-msg.bot.loading {
    background: transparent;
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 8px 14px;
}
.ai-chat-msg.bot.loading span {
    width: 8px; height: 8px; background: #999;
    border-radius: 50%;
    animation: dotPulse 1.2s infinite ease-in-out;
}
.ai-chat-msg.bot.loading span:nth-child(2) { animation-delay: 0.2s; }
.ai-chat-msg.bot.loading span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input area */
.ai-chat-input-wrap {
    display: none;
    padding: 12px 16px;
    border-top: 1px solid #e9ecef;
    gap: 8px;
}
.ai-chat-input-wrap.open { display: flex; }
.ai-chat-input-wrap input {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
}
.ai-chat-input-wrap input:focus { border-color: #FFD700; }
.ai-chat-input-wrap button {
    background: #073692;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    transition: 0.3s;
}
.ai-chat-input-wrap button:hover { background: #052a6e; }

/* End chat button */
.ai-chat-end {
    display: none;
    padding: 8px 16px 12px;
    text-align: center;
}
.ai-chat-end.open { display: block; }
.ai-chat-end button {
    background: none;
    border: 1px solid #dc3545;
    color: #dc3545;
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: 0.3s;
}
.ai-chat-end button:hover { background: #dc3545; color: #fff; }

@media (max-width: 480px) {
    .ai-chat-widget { width: calc(100vw - 40px); right: 20px; bottom: 140px; }
}
