/**
 * Chatbot Widget Styles
 * Modern floating chat widget for Emotion Trip AI Assistant
 */

/* Chatbot Button (Floating) */
.chatbot-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(17, 85, 184, 0.4);
    z-index: 1000;
    transition: all 0.3s ease;
    border: none;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(17, 85, 184, 0.6);
}

.chatbot-button i {
    font-size: 28px;
    color: white;
}

.chatbot-button .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--accent-color);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

.chatbot-window.open {
    display: flex;
}

/* Chatbot Header */
.chatbot-header {
    background: var(--gradient-primary);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    gap: 8px;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.chatbot-header-actions-left,
.chatbot-header-actions-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.chatbot-header-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 16px;
    padding: 0;
}

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

.chatbot-avatar {
    width: 36px;
    height: 36px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatbot-avatar i {
    font-size: 18px;
    color: var(--primary-color);
}

.chatbot-header-text h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatbot-header-text p {
    margin: 0;
    font-size: 11px;
    opacity: 0.9;
}

/* ── History Panel ────────────────────────────── */

.chatbot-history-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 10;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.chatbot-history-panel.open {
    transform: translateX(0);
}

.chatbot-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
    font-size: 16px;
    color: #333;
    flex-shrink: 0;
}

.chatbot-history-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.chatbot-history-close:hover {
    background: #f0f0f0;
}

.chatbot-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.chatbot-history-item {
    position: relative;
    padding: 12px 48px 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s ease;
}

.chatbot-history-item:hover {
    background: #f8f9fa;
}

.chatbot-history-item.active {
    background: #eef3ff;
    border-left: 3px solid var(--primary-color);
    padding-left: 17px;
}

.chatbot-history-item-title {
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
    font-weight: 500;
}

.chatbot-history-item-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #999;
}

.chatbot-history-item-delete {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.15s;
    opacity: 0;
}

.chatbot-history-item:hover .chatbot-history-item-delete {
    opacity: 1;
}

.chatbot-history-item-delete:hover {
    color: #dc3545;
    background: #fee;
}

.chatbot-history-empty {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 14px;
}

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

/* Individual Messages */
.chat-message {
    display: flex;
    gap: 10px;
    max-width: 80%;
    animation: slideIn 0.3s ease;
}

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

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.assistant {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-avatar.user-avatar {
    background: var(--gradient-primary);
    color: white;
}

.message-avatar.assistant-avatar {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.message-avatar i {
    font-size: 16px;
}

.message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
}

.chat-message.user .message-content {
    background: var(--primary-color);
    color: white;
}

.message-content p {
    margin: 0;
    line-height: 1.5;
}

.message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    max-width: 80px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.typing-indicator.active {
    display: flex;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

/* Chat Input */
.chatbot-input {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chatbot-input input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 25px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.chatbot-input input:focus {
    border-color: var(--primary-color);
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chatbot-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(17, 85, 184, 0.3);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chatbot-send-btn i {
    font-size: 16px;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.welcome-message i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.welcome-message h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 8px;
}

.welcome-message p {
    font-size: 14px;
    margin: 0;
}

/* Scrollbar Styling */
.chatbot-messages::-webkit-scrollbar,
.chatbot-history-list::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track,
.chatbot-history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chatbot-messages::-webkit-scrollbar-thumb,
.chatbot-history-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover,
.chatbot-history-list::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chatbot-header {
        border-radius: 0;
    }

    .chatbot-button {
        bottom: 15px;
        right: 15px;
        width: 55px;
        height: 55px;
    }

    .chat-message {
        max-width: 85%;
    }

    .chatbot-history-panel {
        border-radius: 0;
    }
}

/* Loading State */
.chatbot-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.chatbot-loading .spinner-border {
    color: var(--primary-color);
}

/* Error Message */
.chat-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    margin: 10px;
    font-size: 14px;
}
