/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

/* Chatbot Toggle Button */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7B3FF2 0%, #E94CFF 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(123, 63, 242, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.chatbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 32px rgba(123, 63, 242, 0.5);
}

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

.chatbot-toggle svg {
    color: white;
    transition: opacity 0.3s ease;
}

.chatbot-toggle .close-icon {
    position: absolute;
}

/* Chat Badge */
.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #FF4757;
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    animation: pulse 2s infinite;
}

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

/* Chatbot Window */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    background: #1a1a2e;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.3s ease-out;
}

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

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

/* Chatbot Header */
.chatbot-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(123, 63, 242, 0.2) 0%, rgba(233, 76, 255, 0.2) 100%);
    border-radius: 16px 16px 0 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

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

.chatbot-avatar svg {
    color: #E94CFF;
}

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

.chatbot-header-text p {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.chatbot-minimize {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.chatbot-minimize:hover {
    color: white;
}

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

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

.chatbot-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(123, 63, 242, 0.3);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(123, 63, 242, 0.5);
}

/* Chat Message */
.chat-message {
    display: flex;
    animation: messageSlide 0.3s ease-out;
}

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

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

.chat-message.bot {
    justify-content: flex-start;
    flex-direction: column;
    align-items: flex-start;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-message.user .message-content {
    background: linear-gradient(135deg, #7B3FF2 0%, #E94CFF 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.bot .message-content {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.message-content p {
    margin: 0 0 8px 0;
}

.message-content p:last-child {
    margin: 0;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

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

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

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

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    padding: 0 8px;
    animation: fadeInUp 0.5s ease;
    width: 100%;
}

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

.quick-action-btn {
    padding: 12px 20px;
    background: rgba(123, 63, 242, 0.08);
    border: 1px solid rgba(233, 76, 255, 0.3);
    border-radius: 12px;
    color: #E94CFF;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-align: center;
    width: 100%;
    display: block;
}

.quick-action-btn:hover {
    background: rgba(123, 63, 242, 0.15);
    border-color: rgba(233, 76, 255, 0.5);
    transform: translateX(4px);
}

/* Input Container */
.chatbot-input-container {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 16px 16px;
}

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

.chatbot-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 10px 16px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.chatbot-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.chatbot-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(123, 63, 242, 0.5);
}

.chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7B3FF2 0%, #E94CFF 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chatbot-send:hover {
    transform: scale(1.05);
}

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

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

/* Footer */
.chatbot-footer {
    margin-top: 8px;
    text-align: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
}

.chatbot-footer a {
    color: rgba(123, 63, 242, 0.8);
    text-decoration: none;
}

.chatbot-footer a:hover {
    color: #E94CFF;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chatbot-window {
        width: 100vw;
        height: calc(100vh - env(safe-area-inset-top));
        height: calc(100vh - constant(safe-area-inset-top)); /* iOS 11.0-11.2 */
        right: 0;
        bottom: 0;
        top: env(safe-area-inset-top);
        top: constant(safe-area-inset-top); /* iOS 11.0-11.2 */
        border-radius: 0;
        max-height: 100vh;
        padding-top: env(safe-area-inset-top);
        padding-top: constant(safe-area-inset-top); /* iOS 11.0-11.2 */
    }
    
    .chatbot-window.active {
        position: fixed;
        z-index: 10000;
    }
    
    .chatbot-header {
        margin-top: 20px; /* Extra space to ensure visibility under browser UI */
    }
    
    .chatbot-toggle {
        width: 56px;
        height: 56px;
    }
    
    .chatbot-container {
        bottom: 16px;
        right: 16px;
    }
    
    /* Ensure messages area uses available space */
    .chatbot-messages {
        height: calc(100vh - 180px - env(safe-area-inset-top)); /* Account for header, input, and safe area */
        height: calc(100vh - 180px - constant(safe-area-inset-top)); /* iOS 11.0-11.2 */
    }
}

/* Error Message */
.error-message {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
    color: #FF4757;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 8px;
}

/* Success Message */
.success-message {
    background: rgba(46, 213, 115, 0.1);
    border: 1px solid rgba(46, 213, 115, 0.3);
    color: #2ED573;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 8px;
}

/* Mobile optimizations for quick actions */
@media (max-width: 480px) {
    .quick-actions {
        gap: 6px;
        padding: 0 4px;
    }
    
    .quick-action-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}