/* CSS CƠ BẢN */
#ai-chat-widget-container { position: fixed; z-index: 9999; font-family: 'Open Sans', sans-serif; }

.ai-cta-button { padding: 12px 20px; background-color: #198754; color: white; border: none; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.2); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 15px; position: relative; }

.ai-tooltip { position: absolute; bottom: calc(100% + 15px); right: 0; background: white; padding: 10px 30px 10px 15px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.15); font-size: 13px; font-weight: 500; color: #333; white-space: nowrap; animation: bounceIn 0.5s ease; border: 1px solid #e0e0e0; }
.ai-tooltip::after { content: ''; position: absolute; bottom: -6px; right: 20px; width: 12px; height: 12px; background: white; border-right: 1px solid #e0e0e0; border-bottom: 1px solid #e0e0e0; transform: rotate(45deg); }
.close-tooltip-btn { position: absolute; top: 5px; right: 8px; background: none; border: none; font-size: 16px; color: #999; cursor: pointer; line-height: 1; }

.online-dot { width: 8px; height: 8px; background-color: #28a745; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 rgba(40, 167, 69, 0.7); animation: pulse_online 2s infinite; border: 1px solid #fff; }
@keyframes pulse_online { 0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); } 70% { box-shadow: 0 0 0 6px rgba(40, 167, 69, 0); } 100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); } }

/* Lựa chọn nhanh HÀNG DỌC */
.quick-replies-vertical { display: flex; flex-direction: column; gap: 8px; padding-left: 10px; margin-top: 5px; margin-bottom: 10px; max-width: 85%; }
.qr-btn-vertical { background: white; border: 1px solid #198754; color: #198754; padding: 8px 14px; border-radius: 16px; font-size: 13px; text-align: left; cursor: pointer; transition: all 0.2s ease; font-weight: 500; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.qr-btn-vertical:hover { background: #198754; color: white; transform: translateX(3px); box-shadow: 0 3px 6px rgba(0,0,0,0.1); }

/* Layout Chat */
.chat-window { background: white; border-radius: 12px; box-shadow: 0 5px 25px rgba(0,0,0,0.2); display: flex; flex-direction: column; overflow: hidden; border: 1px solid #e0e0e0; animation: slideInUp 0.3s ease; }
.chat-header { background-color: #198754; color: white; padding: 12px 15px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #146c43; }
.close-btn { background: none; border: none; color: white; font-size: 28px; cursor: pointer; line-height: 1; }
.chat-quick-contact { border-bottom: 1px solid #e0e0e0; }
.qc-btn { display: inline-block; transition: transform 0.2s ease-in-out; }
.qc-btn img { border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.qc-btn:hover { transform: scale(1.15) translateY(-2px); }
.chat-body { flex: 1; padding: 15px; overflow-y: auto; background-color: #f8f9fa; display: flex; flex-direction: column; gap: 10px; }
.message { display: flex; margin-bottom: 5px; }
.bot-message { justify-content: flex-start; }
.user-message { justify-content: flex-end; }
.msg-bubble { max-width: 80%; padding: 10px 14px; border-radius: 15px; font-size: 14px; line-height: 1.4; word-wrap: break-word; }
.bot-message .msg-bubble { background-color: #e9ecef; color: #333; border-top-left-radius: 2px; }
.user-message .msg-bubble { background-color: #198754; color: white; border-top-right-radius: 2px; }
.chat-footer { padding: 10px; border-top: 1px solid #eee; background: white; }
.chat-footer input { border-radius: 20px; font-size: 14px; padding-left: 15px; }
.send-btn { border-radius: 20px; height: 38px; padding: 0 16px; display: flex; align-items: center; justify-content: center; background-color: #198754; border-color: #198754; font-weight: 500; font-size: 14px; cursor: pointer;}
.send-btn:hover { background-color: #146c43; border-color: #146c43; }

/* DARK MODE LỘT XÁC */
.dark-mode .chat-window { background-color: #1e1e1e; border-color: #333; }
.dark-mode .chat-body { background-color: #121212; }
.dark-mode .chat-footer, .dark-mode .chat-quick-contact { background-color: #1e1e1e !important; border-bottom-color: #333 !important; border-top-color: #333 !important; }
.dark-mode .bot-message .msg-bubble { background-color: #333; color: #eee; }
.dark-mode .user-message .msg-bubble { background-color: #146c43; }
.dark-mode .form-control { background-color: #333; color: white; border-color: #444; }
.dark-mode .form-control::placeholder { color: #888; }
.dark-mode .chat-quick-contact span { color: #aaa !important; }
.dark-mode .qr-btn-vertical { background: #1e1e1e; border-color: #146c43; color: #d1e7dd; box-shadow: none; }
.dark-mode .qr-btn-vertical:hover { background: #146c43; color: white; }

/* Hiệu ứng */
.typing-indicator span { display: inline-block; width: 6px; height: 6px; background-color: #999; border-radius: 50%; margin: 0 2px; animation: typing 1s infinite; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; } .typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes slideInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bounceIn { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.d-none { display: none !important; }

/* Responsive */
@media (min-width: 769px) {
    #ai-chat-widget-container { bottom: 60px; right: 30px; }
    .chat-window { position: absolute; bottom: 80px; right: 0; width: 500px; height: 600px; }
    .ai-cta-shaking-desktop { animation: shake_desktop 2.5s infinite; }
    @keyframes shake_desktop { 0%, 100% { transform: scale(1); } 5%, 15%, 25% { transform: scale(1) translateX(-3px) rotate(-2deg); } 10%, 20% { transform: scale(1) translateX(3px) rotate(2deg); } 30%, 100% { transform: scale(1); } }
}

@media (max-width: 768px) {
    #ai-chat-widget-container { bottom: 20px; right: 15px; }
    .ai-cta-button { padding: 10px 15px; font-size: 14px; border-radius: 6px; animation: vibrate_mobile 3s infinite; }
    @keyframes vibrate_mobile { 0%, 100% { transform: scale(1); } 10%, 20% { transform: scale(1.02); } 15% { transform: scale(1.02) translateX(-1px); } 30%, 100% { transform: scale(1); } }
    .chat-window { position: fixed; bottom: 20px; right: 15px; width: calc(100vw - 30px); height: calc(100vh - 120px); z-index: 100000; }
    .ai-tooltip { right: -5px; } 
}
