/* ========================================
   CHATBOT STYLES - Cửu Long Tranh Bá
   ======================================== */

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Chatbot Icon (Floating Button) */
.chatbot-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f6be49 0%, #f39c12 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(246, 190, 73, 0.4);
    transition: all 0.3s ease;
    position: relative;
    animation: pulse-ring 2s infinite;
}

.chatbot-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(246, 190, 73, 0.6);
}

.chatbot-icon i {
    font-size: 28px;
    color: #fff;
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(246, 190, 73, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(246, 190, 73, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(246, 190, 73, 0);
    }
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    height: 600px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.chatbot-window-open {
    transform: scale(1);
    opacity: 1;
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, #f6be49 0%, #f39c12 100%);
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
}

.chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header-left i {
    font-size: 24px;
}

.chatbot-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}

.chatbot-status {
    font-size: 11px;
    opacity: 0.9;
}

.chatbot-header-actions {
    display: flex;
    gap: 5px;
}

.chatbot-minimize,
.chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chatbot-minimize:hover,
.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Quick Questions */
.chatbot-quick-questions {
    background: #f8f9fa;
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    max-height: 180px;
    overflow-y: auto;
}

.quick-question-title {
    font-size: 12px;
    font-weight: bold;
    color: #666;
    margin-bottom: 10px;
}

.quick-question-btn {
    display: block;
    width: 100%;
    background: #fff;
    border: 1px solid #e0e0e0;
    color: #333;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 10px;
    text-align: left;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-question-btn:hover {
    background: linear-gradient(135deg, #f6be49 0%, #f39c12 100%);
    color: #fff;
    border-color: #f6be49;
    transform: translateX(5px);
}

/* Messages Container */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #f6be49;
    border-radius: 10px;
}

/* Message */
.chatbot-message {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f6be49 0%, #f39c12 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.message-text {
    background: #fff;
    padding: 12px 15px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
    padding: 0 5px;
}

/* Bot Message */
.bot-message .message-text {
    background: #fff;
    border: 1px solid #e0e0e0;
}

/* User Message */
.user-message {
    flex-direction: row-reverse;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.user-message .message-content {
    align-items: flex-end;
}

.user-message .message-text {
    background: linear-gradient(135deg, #f6be49 0%, #f39c12 100%);
    color: #fff;
}

.user-message .message-time {
    text-align: right;
}

/* Typing Indicator */
.typing-indicator .message-text {
    background: #fff;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.typing-dots {
    display: flex;
    gap: 5px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f6be49;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input Container */
.chatbot-input-container {
    display: flex;
    padding: 15px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    gap: 10px;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.chatbot-input:focus {
    border-color: #f6be49;
    box-shadow: 0 0 0 3px rgba(246, 190, 73, 0.1);
}

.chatbot-send {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f6be49 0%, #f39c12 100%);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(246, 190, 73, 0.3);
}

.chatbot-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(246, 190, 73, 0.5);
}

.chatbot-send i {
    font-size: 16px;
}

/* Footer */
.chatbot-footer {
    background: #f8f9fa;
    padding: 10px;
    text-align: center;
    border-top: 1px solid #e0e0e0;
}

.chatbot-footer small {
    color: #999;
    font-size: 11px;
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    .chatbot-container {
        bottom: 10px;
        right: 10px;
    }

    .chatbot-icon {
        width: 55px;
        height: 55px;
    }

    .chatbot-icon i {
        font-size: 24px;
    }

    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
        bottom: 10px;
        right: 10px;
        max-width: 400px;
        max-height: 600px;
    }

    .chatbot-quick-questions {
        max-height: 150px;
    }

    .quick-question-btn {
        font-size: 12px;
        padding: 8px 10px;
    }

    .message-text {
        font-size: 13px;
        padding: 10px 12px;
    }
}

@media screen and (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 10px);
        height: calc(100vh - 80px);
        bottom: 5px;
        right: 5px;
        border-radius: 15px;
    }

    .chatbot-header {
        padding: 12px 15px;
        border-radius: 15px 15px 0 0;
    }

    .chatbot-header h4 {
        font-size: 14px;
    }

    .chatbot-messages {
        padding: 15px 10px;
    }

    .message-avatar {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }

    .chatbot-input-container {
        padding: 10px;
    }

    .chatbot-input {
        padding: 10px 15px;
        font-size: 13px;
    }

    .chatbot-send {
        width: 40px;
        height: 40px;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .chatbot-window {
        background: #1e1e1e;
    }

    .chatbot-messages {
        background: #2d2d2d;
    }

    .message-text {
        background: #3a3a3a;
        color: #e0e0e0;
        border-color: #4a4a4a;
    }

    .bot-message .message-text {
        background: #3a3a3a;
        border-color: #4a4a4a;
    }

    .chatbot-input {
        background: #3a3a3a;
        color: #e0e0e0;
        border-color: #4a4a4a;
    }

    .chatbot-input-container {
        background: #2d2d2d;
        border-top-color: #4a4a4a;
    }

    .chatbot-footer {
        background: #2d2d2d;
        border-top-color: #4a4a4a;
    }

    .quick-question-btn {
        background: #3a3a3a;
        color: #e0e0e0;
        border-color: #4a4a4a;
    }

    .chatbot-quick-questions {
        background: #2d2d2d;
        border-bottom-color: #4a4a4a;
    }
}

/* Custom Scrollbar for Webkit Browsers */
.chatbot-quick-questions::-webkit-scrollbar {
    width: 6px;
}

.chatbot-quick-questions::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chatbot-quick-questions::-webkit-scrollbar-thumb {
    background: #f6be49;
    border-radius: 10px;
}

/* Animation for Window Open/Close */
@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Enhance Message Formatting */
.message-text strong {
    font-weight: 700;
    color: #f39c12;
}

.message-text em {
    font-style: italic;
    color: #666;
}

.user-message .message-text strong,
.user-message .message-text em {
    color: #fff;
}

/* Link Styling in Messages */
.message-text a {
    color: #f39c12;
    text-decoration: underline;
}

.message-text a:hover {
    color: #f6be49;
}

.user-message .message-text a {
    color: #fff;
    font-weight: bold;
}

/* Badge for unread messages (optional feature) */
.chatbot-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    padding: 3px 7px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Loading State */
.chatbot-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.chatbot-loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #f6be49;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Message */
.error-message .message-text {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    color: #c53030;
}

/* Success Message */
.success-message .message-text {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    color: #2f855a;
}

