
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    padding: 20px;
}

/* Chatbot Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 50px;
    right: 20px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1001;
    width: 100px;
    height: 100px;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
}

.chatbot-toggle svg {
    width: 24px;
    height: 24px;
    fill: white;
}

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
}

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

.chatbot-container.show {
    display: flex;
}

.chatbot-toggle.hidden {
    display: none !important;
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.header-left-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    min-width: 100px;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    margin: 0 16px;
}

.header-text h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px 0;
    letter-spacing: 0.5px;
}

.header-text p {
    font-size: 13px;
    opacity: 0.9;
    margin: 0;
    font-weight: 400;
}

.header-right-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 40px;
}

.language-selector {
    position: relative;
}

.language-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(10px);
    width: 83px;
    height: 32px;
}

.language-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.language-flag {
    font-size: 14px;
}

.language-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: white;
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 140px;
    display: none;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.language-dropdown.show {
    display: block;
    animation: dropdownFade 0.2s ease-out;
}

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

.language-option {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    border: none;
    background: transparent;
}

.language-option:hover {
    background: #f8f9fa;
    color: #4CAF50;
}

.language-option.active {
    background: #e8f5e8;
    color: #4CAF50;
    font-weight: 600;
}

.language-option .language-flag {
    font-size: 16px;
}

.language-option:first-child {
    border-radius: 8px 8px 0 0;
}

.language-option:last-child {
    border-radius: 0 0 8px 8px;
}

.service-action-buttons {
    display: flex;
    gap: 8px;
    margin: 12px 0;
    justify-content: center;
}

.action-btn {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-btn:hover {
    background: linear-gradient(135deg, #1976D2, #1565C0);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.action-btn.quote {
    background: linear-gradient(135deg, #FF9800, #F57C00);
}

.action-btn.quote:hover {
    background: linear-gradient(135deg, #F57C00, #E65100);
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.restart-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    width: 83px;
    height: 32px;
}

.restart-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.close-btn svg {
    width: 16px;
    height: 16px;
}

/* Messages Area */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease-out;
    align-items: flex-start;
}

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

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex: none; 
    flex-shrink: 0;
    flex-grow: 0; 
}

.message.bot .message-avatar {
    background: #4CAF50;
    color: white;
}

.message.user .message-avatar {
    background: lightgray;
    color: white;
}

.avatar-image {
    width: 24px;
    height: 24px;
}

/* Chỉ apply cho text messages */
.text-message {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    white-space: pre-line;
    line-height: 1.5;
}

/* Đảm bảo typing indicator không bị ảnh hưởng */
.typing-indicator .message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    white-space: normal;
    line-height: 1.4;
}

.message-content.with-form {
    max-width: 85%;
    padding: 16px;
}

.message.bot .message-content {
    background: #f1f3f5;
    color: #333;
    border-bottom-left-radius: 6px;
}

.message.user .message-content {
    background: #4CAF50;
    color: white;
    border-bottom-right-radius: 6px;
}

.welcome-message {
    color: #333;
    font-size: 14px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
    line-height: 1.6;
}

.welcome-title {
    font-weight: 600;
    margin-bottom: 12px;
    color: #2c3e50;
}

.option-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 16px 0 12px 0;
}

.option-btn {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-btn:hover {
    background: #f0f7ff;
    border-color: #4CAF50;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.15);
}

.option-btn .number {
    background: #4CAF50;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.option-btn .text {
    flex: 1;
}

.sub-option-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 16px 0;
}

.sub-option-btn {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sub-option-btn:hover {
    background: #f0f7ff;
    border-color: #4CAF50;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.15);
}

.sub-option-btn.back-btn {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #6c757d;
}

.sub-option-btn.back-btn:hover {
    background: #e9ecef;
    border-color: #6c757d;
}

.sub-option-btn .number {
    background: #2196F3;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.sub-option-btn.back-btn .number {
    background: #6c757d;
}

.sub-option-btn .text {
    flex: 1;
}

/* Input Area */
.input-container {
    padding: 16px 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 12px;
    align-items: center;
}

.message-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.message-input:focus {
    border-color: #4CAF50;
}

.send-btn {
    width: 40px;
    height: 40px;
    background: #4CAF50;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.send-btn:hover {
    background: #45a049;
    transform: scale(1.05);
}

.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.send-btn svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 10px;
    align-items: center;
}

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

.typing-dot {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .chatbot-container {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        right: 20px;
        left: 20px;
        bottom: 90px;
    }

    .chatbot-header {
        padding: 14px 16px;
    }
    
    .header-content {
        margin: 0 12px;
    }
    
    .header-text h3 {
        font-size: 16px;
    }
    
    .header-text p {
        font-size: 12px;
    }
    
    .restart-btn,
    .language-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .close-btn {
        padding: 6px;
    }
    
    .header-left-buttons {
        min-width: 80px;
        gap: 6px;
    }
    
    .language-dropdown {
        min-width: 120px;
    }
}

@media (max-width: 360px) {
    .header-text h3 {
        font-size: 14px;
    }
    
    .header-text p {
        font-size: 11px;
    }
    
    .restart-btn,
    .language-btn {
        font-size: 10px;
        padding: 5px 8px;
    }
}
/* Image Upload Interface */
.image-question-content {
    max-width: 85% !important;
}

.image-upload-container {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    background: #fafafa;
}

.image-upload-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 12px;
}

.upload-image-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 120px;
    justify-content: center;
}

.upload-image-btn:hover {
    background: linear-gradient(135deg, #45a049, #3d8b40);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.skip-image-btn {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 120px;
    justify-content: center;
}

.skip-image-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.15);
}

.question-text {
    font-weight: 500 !important;
    color: #2c3e50 !important;
    margin-bottom: 16px !important;
}

/* Upload progress and preview */
.image-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    margin: 12px auto;
    display: block;
    border: 1px solid #ddd;
}

.upload-progress {
    background: #e9ecef;
    border-radius: 4px;
    height: 6px;
    margin: 12px 0;
    overflow: hidden;
}

.upload-progress-bar {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    height: 100%;
    transition: width 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .image-upload-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .upload-image-btn,
    .skip-image-btn {
        min-width: auto;
        width: 100%;
    }
    
    .image-question-content {
        max-width: 95% !important;
    }
}
.location-message {
    background: #fff3cd !important;
    border-left: 4px solid #ffc107 !important;
    color: #856404 !important;
    padding: 12px 16px !important;
    border-radius: 8px !important;
}

.location-success {
    background: #d4edda !important;
    border-left: 4px solid #28a745 !important;
    color: #155724 !important;
}

.location-error {
    background: #f8d7da !important;
    border-left: 4px solid #dc3545 !important;
    color: #721c24 !important;
}
.multiple-images-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
}

.image-preview-item {
    position: relative;
    max-width: 80px;
    max-height: 80px;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.image-count-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
}

@media (max-width: 480px) {
    .upload-image-btn {
        font-size: 12px;
        padding: 8px 12px;
    }
}
