/* ============================================
   JTI Connect AI Chatbot Widget Styles
   ============================================ */

/* Chatbot Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color, #00a859) 0%, #008a47 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 168, 89, 0.4);
    cursor: pointer;
    z-index: 9998;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 168, 89, 0.5);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

.chatbot-toggle .chatbot-icon,
.chatbot-toggle .chatbot-close-icon {
    width: 28px;
    height: 28px;
    transition: all 0.3s ease;
}

.chatbot-toggle .chatbot-close-icon {
    position: absolute;
    opacity: 0;
    transform: rotate(90deg);
}

.chatbot-toggle.active .chatbot-icon {
    opacity: 0;
    transform: rotate(-90deg);
}

.chatbot-toggle.active .chatbot-close-icon {
    opacity: 1;
    transform: rotate(0deg);
}

/* Notification Badge */
.chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff4444;
    color: white;
    font-size: 12px;
    font-weight: 600;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
}

.chatbot-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, var(--primary-color, #00a859) 0%, #008a47 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-avatar svg {
    width: 24px;
    height: 24px;
}

.chatbot-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chatbot-minimize {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chatbot-minimize:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chatbot-minimize svg {
    width: 20px;
    height: 20px;
}

/* Messages Container */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

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

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Messages */
.chatbot-message {
    display: flex;
    animation: messageSlideIn 0.3s ease;
}

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

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

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

.message-content {
    max-width: 80%;
    display: flex;
    flex-direction: column;
}

.message-text {
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
}

.user-message .message-text {
    background: var(--primary-color, #00a859);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-text {
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    padding: 0 4px;
}

.user-message .message-time {
    text-align: right;
}

.bot-message .message-time {
    text-align: left;
}

/* Suggested-action quick-reply buttons (Did you mean?) */
.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    padding: 0 4px;
}

.chatbot-suggestion-btn {
    background: transparent;
    color: var(--primary-color, #00a859);
    border: 1.5px solid var(--primary-color, #00a859);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: normal;
    text-align: left;
}

.chatbot-suggestion-btn:hover {
    background: var(--primary-color, #00a859);
    color: white;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

/* Quick Actions */
.chatbot-quick-actions {
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-action-btn {
    padding: 8px 14px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.quick-action-btn:hover {
    background: var(--primary-color, #00a859);
    color: white;
    border-color: var(--primary-color, #00a859);
    transform: translateY(-1px);
}

/* Input Area */
.chatbot-input-area {
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 16px 20px;
}

.chatbot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.chatbot-input:focus {
    border-color: var(--primary-color, #00a859);
    box-shadow: 0 0 0 3px rgba(0, 168, 89, 0.1);
}

.chatbot-send-btn {
    width: 42px;
    height: 42px;
    background: var(--primary-color, #00a859);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    background: #008a47;
    transform: scale(1.05);
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

.chatbot-send-btn svg {
    width: 20px;
    height: 20px;
}

.chatbot-footer-text {
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 8px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .chatbot-window.active {
        bottom: 0;
    }
    
    .chatbot-toggle {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }
    
    .chatbot-header {
        border-radius: 0;
    }
}

/* Dark Mode Support */
.dark-mode .chatbot-window {
    background: #1f2937;
}

.dark-mode .chatbot-messages {
    background: #111827;
}

.dark-mode .bot-message .message-text {
    background: #374151;
    color: #f9fafb;
}

.dark-mode .chatbot-input-area,
.dark-mode .chatbot-quick-actions {
    background: #1f2937;
    border-color: #374151;
}

.dark-mode .chatbot-input {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

.dark-mode .chatbot-input::placeholder {
    color: #9ca3af;
}

.dark-mode .quick-action-btn {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

.dark-mode .message-time {
    color: #6b7280;
}
.dark-mode .chatbot-suggestion-btn {
    color: #34d399;
    border-color: #34d399;
}

.dark-mode .chatbot-suggestion-btn:hover {
    background: #34d399;
    color: #111827;
}
#chatbotToggle, .chatbot-toggle { display: none !important; }
