/**
 * AI Chatbot Widget Styles
 */

.ai-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: bottom 0.3s ease;
}

/* When sticky booking bar is visible, move chatbot above it */
.ai-chatbot-container.sticky-bar-visible {
    bottom: 80px; /* Height of sticky bar + padding */
}

/* Alternative positioning for middle of screen when needed */
.ai-chatbot-container.middle-position {
    bottom: 50vh;
    transform: translateY(50%);
}

/* Chat Toggle Button */
.chat-toggle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 16px 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    user-select: none;
}

.chat-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.chat-toggle-btn.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.chat-toggle-text {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .chat-toggle-text {
        display: none;
    }
    
    .chat-toggle-btn {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        padding: 0;
        justify-content: center;
    }
    
    /* On mobile, when sticky bar is visible, position chatbot above it */
    .ai-chatbot-container.sticky-bar-visible {
        bottom: 70px; /* Slightly less space on mobile */
    }
    
    /* Middle position adjustment for mobile */
    .ai-chatbot-container.middle-position {
        bottom: 45vh;
        right: 15px; /* Slightly closer to edge on mobile */
    }
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    pointer-events: none;
    overflow: hidden;
}

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

@media (max-width: 768px) {
    .chat-window {
        width: calc(100vw - 40px);
        height: 70vh;
        max-height: 500px;
        bottom: 80px;
        right: 20px;
    }
}

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

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.chat-header-text h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-status {
    font-size: 12px;
    opacity: 0.8;
}

.chat-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

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

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

.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
}

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

.bot-message {
    align-self: flex-start;
}

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

.user-message .message-avatar {
    background: #007bff;
    color: white;
}

.bot-message .message-avatar {
    background: #e9ecef;
}

.message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-message .message-content {
    background: #007bff;
    color: white;
}

.message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

.error-message .message-content {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Typing Indicator */
.typing-indicator .message-content {
    padding: 16px;
}

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

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

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

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

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

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

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#chat-input {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

#chat-input:focus {
    border-color: #667eea;
}

#chat-input:disabled {
    background: #f8f9fa;
    cursor: not-allowed;
}

.chat-send-btn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    background: #5a6fd8;
    transform: scale(1.05);
}

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

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

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

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

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

/* Links in messages */
.message-content a {
    color: inherit;
    text-decoration: underline;
}

.user-message .message-content a {
    color: rgba(255, 255, 255, 0.9);
}

/* Animation for new messages */
.message {
    animation: slideIn 0.3s ease-out;
}

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

/* Usage warning styles */
.usage-warning {
    padding: 8px 16px;
    margin: 8px 0;
    text-align: center;
    animation: slideIn 0.3s ease-out;
}

.usage-warning .warning-content {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 12px;
    padding: 6px 12px;
    color: #856404;
    font-size: 12px;
}

/* Rate limit error styling */
.error-message .message-content {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Disabled input styling */
#chat-input:disabled {
    background: #f8f9fa;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Booking link styling */
.booking-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
    font-weight: 600;
    margin: 4px 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.booking-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    text-decoration: none;
    color: white !important;
}

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

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .chat-window {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .chat-messages {
        background: #1a202c;
    }
    
    .booking-link {
        background: linear-gradient(135deg, #4299e1 0%, #9f7aea 100%);
        box-shadow: 0 2px 8px rgba(66, 153, 225, 0.3);
    }
    
    .booking-link:hover {
        box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
    }
    
    .message-content {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .bot-message .message-avatar {
        background: #4a5568;
    }
    
    .chat-input-container {
        background: #2d3748;
        border-top-color: #4a5568;
    }
    
    #chat-input {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    #chat-input:focus {
        border-color: #667eea;
    }
}

/* Typing Indicator Styles */
.typing-message {
    opacity: 0.8;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #94a3b8;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

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

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

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

/* Status Typing Animation */
.chat-status.typing {
    color: #10b981;
    font-style: italic;
}

/* Top Chat Icon Styles */
.top-chat-icon {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50px;
    padding: 12px 20px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.top-chat-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.top-chat-content {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.top-chat-avatar {
    font-size: 20px;
    line-height: 1;
}

.top-chat-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.top-chat-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
}

.top-chat-subtitle {
    font-size: 12px;
    opacity: 0.9;
    line-height: 1.2;
}

.top-chat-pulse {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(74, 222, 128, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
    }
}

/* Hide top chat icon on mobile and tablet - desktop only */
@media (max-width: 768px) {
    .top-chat-icon {
        display: none !important;
    }
}
