/* B Store AI Chatbot V3 Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Kanit', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-y: auto;
}

.chat-container {
    width: 100%;
    max-width: 800px;
    min-height: 100vh;
    background: #ffffff;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Header Styles */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bot-avatar {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 15px;
}

.bot-info h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
}

.bot-status {
    display: flex;
    align-items: center;
    font-size: 14px;
    opacity: 0.9;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.online {
    background: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.status-indicator.offline {
    background: #F44336;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* User Journey Indicator */
.user-journey {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.journey-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
}

.journey-step i {
    font-size: 20px;
    margin-bottom: 5px;
    color: #6c757d;
}

.journey-step span {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

.journey-step.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: scale(1.05);
}

.journey-step.active i,
.journey-step.active span {
    color: white;
}

.journey-step.completed {
    background: #e8f5e8;
    color: #4CAF50;
}

.journey-step.completed i,
.journey-step.completed span {
    color: #4CAF50;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 120px;
    background: #f8f9fa;
}

.message {
    display: flex;
    margin-bottom: 20px;
    animation: fadeInUp 0.3s ease;
}

.user-message {
    justify-content: flex-end;
}

.bot-message {
    justify-content: flex-start;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin: 0 10px;
}

.bot-message .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.user-message .message-avatar {
    background: #e9ecef;
    color: #495057;
}

.message-content {
    max-width: 70%;
    position: relative;
}

.message-text {
    padding: 15px 20px;
    border-radius: 20px;
    line-height: 1.6;
    word-wrap: break-word;
}

.bot-message .message-text {
    background: white;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.user-message .message-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

.message-time {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.confidence-badge {
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.personalized-badge {
    background: #17a2b8;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Welcome Message */
.welcome-message .message-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.welcome-message h3 {
    margin-bottom: 10px;
    font-size: 18px;
}

.welcome-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.feature-item i {
    width: 20px;
    text-align: center;
}

/* Quick Suggestions */
.quick-suggestions {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.suggestions-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-weight: 600;
    color: #495057;
}

.suggestions-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.suggestion-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
}

.suggestion-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.suggestion-icon {
    font-size: 16px;
}

/* Follow-up Questions */
.follow-up-section {
    padding: 15px 20px;
    background: #fff3cd;
    border-top: 1px solid #ffeaa7;
}

.follow-up-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #856404;
}

.follow-up-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.follow-up-btn {
    background: white;
    border: 1px solid #ffeaa7;
    border-radius: 10px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
    font-size: 14px;
    text-align: left;
    color: #856404;
}

.follow-up-btn:hover {
    background: #ffeaa7;
    transform: translateX(5px);
}

/* Chat Input */
.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#user-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-family: 'Kanit', sans-serif;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

#user-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-btn {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 18px;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.input-features {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6c757d;
    font-size: 14px;
}

.typing-indicator span:nth-child(1),
.typing-indicator span:nth-child(2),
.typing-indicator span:nth-child(3) {
    width: 6px;
    height: 6px;
    background: #6c757d;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

/* Confidence Meter */
.confidence-meter {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #6c757d;
}

.confidence-bar {
    width: 100px;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: #4CAF50;
    transition: width 0.5s ease;
    border-radius: 3px;
}

/* Insights Panel */
.insights-panel {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 250px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.insights-header {
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.insights-header h4 {
    font-size: 16px;
    font-weight: 600;
}

.toggle-insights {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
}

.insights-content {
    padding: 15px;
}

.insight-item {
    margin-bottom: 15px;
}

.insight-label {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 5px;
    display: block;
}

.engagement-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.engagement-fill {
    height: 100%;
    background: #4CAF50;
    transition: width 0.5s ease;
    border-radius: 4px;
}

.interest-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.interest-tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 20px;
}

/* Analytics Styles */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.analytics-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.analytics-card h4 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 16px;
}

.analytics-value {
    font-size: 32px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 5px;
}

.analytics-label {
    font-size: 14px;
    color: #6c757d;
}

.recommendations-section h4 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 18px;
}

.recommendations-list {
    list-style: none;
}

.recommendations-list li {
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
    color: #495057;
}

.recommendations-list li:last-child {
    border-bottom: none;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .chat-container {
        min-height: 100vh;
        border-radius: 0;
    }
    
    .chat-header {
        padding: 15px;
    }
    
    .bot-info h1 {
        font-size: 20px;
    }
    
    .user-journey {
        padding: 10px 15px;
    }
    
    .journey-step {
        padding: 8px;
    }
    
    .journey-step i {
        font-size: 16px;
    }
    
    .journey-step span {
        font-size: 11px;
    }
    
    .chat-messages {
        padding: 15px;
        padding-bottom: 140px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .suggestions-list {
        grid-template-columns: 1fr;
    }
    
    .insights-panel {
        position: relative;
        top: 0;
        right: 0;
        width: 100%;
        margin: 10px 0;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .analytics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .bot-avatar {
        margin-right: 0;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .input-wrapper {
        flex-direction: row;
        gap: 10px;
    }
    
    .send-btn {
        flex-shrink: 0;
    }
    
    .chat-messages {
        padding-bottom: 160px;
    }
}

/* Custom Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Text Formatting */
.message-text strong {
    font-weight: 600;
    color: inherit;
}

.message-text em {
    font-style: italic;
}

.bullet {
    color: #667eea;
    font-weight: bold;
    margin-right: 5px;
}



/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Ensure proper scrolling on all devices */
body, html {
    overflow-x: hidden;
}

/* Fix for iOS Safari */
.chat-container {
    -webkit-overflow-scrolling: touch;
}

.chat-messages {
    -webkit-overflow-scrolling: touch;
}

/* Additional mobile fixes */
@media (max-width: 768px) {
    /* Prevent zoom on input focus */
    input[type="text"], input[type="email"], input[type="password"], textarea {
        font-size: 16px;
    }
    
    /* Ensure full height on mobile */
    .chat-container {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
}

/* Fix for mobile viewport height */
@supports (-webkit-touch-callout: none) {
    .chat-container {
        min-height: -webkit-fill-available;
    }
}


/* Clickable Links in Chat */
.chat-link {
    color: #2196F3;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid #2196F3;
    transition: all 0.3s ease;
    padding: 2px 4px;
    border-radius: 4px;
    background: rgba(33, 150, 243, 0.1);
}

.chat-link:hover {
    background: rgba(33, 150, 243, 0.2);
    color: #1976D2;
    border-bottom-color: #1976D2;
    transform: translateY(-1px);
}

.chat-link:active {
    transform: translateY(0);
}

/* Link Icon */
.chat-link::after {
    content: " 🔗";
    font-size: 0.8em;
    opacity: 0.7;
}

/* Special styling for different link types */
.chat-link[href*="bstoreonline.com"]::after {
    content: " 🏪";
}

.chat-link[href*="manus.space"]::after {
    content: " 🎯";
}

.chat-link[href*="download"]::after {
    content: " 📱";
}

.chat-link[href*="rewards"]::after {
    content: " 💰";
}

/* Mobile responsive links */
@media (max-width: 768px) {
    .chat-link {
        display: inline-block;
        margin: 2px 0;
        padding: 4px 8px;
        font-size: 14px;
    }
}


/* Enhanced Clickable Links */
.chat-link {
    color: #007bff !important;
    text-decoration: underline !important;
    cursor: pointer !important;
    transition: all 0.3s ease;
    font-weight: 500;
}

.chat-link:hover {
    color: #0056b3 !important;
    text-decoration: none !important;
    background-color: rgba(0, 123, 255, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
}

.chat-link:active {
    color: #004085 !important;
    transform: scale(0.98);
}

/* Link styling in bot messages */
.bot-message a {
    color: #007bff !important;
    text-decoration: underline !important;
    cursor: pointer !important;
    font-weight: 500;
}

.bot-message a:hover {
    color: #0056b3 !important;
    background-color: rgba(0, 123, 255, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    text-decoration: none !important;
}

/* Ensure links are clickable on mobile */
@media (max-width: 768px) {
    .chat-link, .bot-message a {
        min-height: 44px;
        display: inline-block;
        line-height: 1.4;
        padding: 8px 4px;
    }
}



/* Google Translate Widget Styles */
.translate-widget {
    margin-right: 10px;
}

/* Style Google Translate dropdown */
.goog-te-combo {
    background: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 8px !important;
    color: white !important;
    padding: 8px 12px !important;
    font-family: 'Kanit', sans-serif !important;
    font-size: 14px !important;
    outline: none !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.goog-te-combo:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.goog-te-combo:focus {
    background: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.7) !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2) !important;
}

/* Hide Google Translate banner */
.goog-te-banner-frame {
    display: none !important;
}

body {
    top: 0 !important;
}

/* Style Google Translate gadget */
.goog-te-gadget {
    font-family: 'Kanit', sans-serif !important;
    font-size: 0 !important;
}

.goog-te-gadget .goog-te-combo {
    margin: 0 !important;
}

/* Hide "Powered by Google" text */
.goog-te-gadget-simple .goog-te-menu-value span:first-child {
    display: none;
}

.goog-te-gadget-simple .goog-te-menu-value:before {
    content: '🌍 ';
    font-size: 16px;
}

/* Custom translate button style */
.goog-te-gadget-simple {
    background: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    font-family: 'Kanit', sans-serif !important;
    color: white !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.goog-te-gadget-simple:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.goog-te-menu-value {
    color: white !important;
}

.goog-te-menu-value span {
    color: white !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .translate-widget {
        margin-right: 5px;
    }
    
    .goog-te-gadget-simple {
        padding: 6px 8px !important;
        font-size: 12px !important;
    }
    
    .goog-te-combo {
        padding: 6px 8px !important;
        font-size: 12px !important;
    }
}

/* Fix for translated content */
.translated-ltr {
    direction: ltr !important;
}

.translated-rtl {
    direction: rtl !important;
}

/* Ensure chat messages maintain proper styling when translated */
.chat-messages.translated .message {
    font-family: 'Kanit', sans-serif !important;
}

.chat-messages.translated .bot-message {
    background: linear-gradient(135deg, #f8f9ff 0%, #e8f0ff 100%) !important;
}

.chat-messages.translated .user-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
}

