/* AI Chat Widget Styles */

/* Chat Widget Container */
#ai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Chat Button */
#chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #b87cff, #59c3ff);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(155, 89, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

#chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(155, 89, 255, 0.6);
}

#chat-button svg {
    width: 28px;
    height: 28px;
    color: white;
}

/* Pulse Animation */
#chat-button::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(184, 124, 255, 0.5);
    animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Chat Window */
#chat-window {
    display: none;
    flex-direction: column;
    width: 380px;
    height: 550px;
    background: rgba(20, 15, 35, 0.98);
    border-radius: 20px;
    border: 1px solid rgba(155, 89, 255, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    position: fixed;
    bottom: 90px;
    right: 20px;
    animation: slideUp 0.3s ease-out;
}

#chat-window.active {
    display: flex;
}

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

/* Chat Header */
#chat-header {
    padding: 20px;
    background: linear-gradient(135deg, rgba(155, 89, 255, 0.3), rgba(89, 195, 255, 0.3));
    border-radius: 20px 20px 0 0;
    border-bottom: 1px solid rgba(155, 89, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#chat-header h3 {
    color: #fff;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

#chat-header p {
    color: rgba(220, 215, 255, 0.8);
    margin: 4px 0 0 0;
    font-size: 0.85rem;
}

#close-chat {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

#close-chat:hover {
    color: #fff;
}

#close-chat svg {
    width: 24px;
    height: 24px;
}

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

#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: rgba(155, 89, 255, 0.1);
    border-radius: 10px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: rgba(155, 89, 255, 0.5);
    border-radius: 10px;
}

.message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
}

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

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

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

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

.message.user .message-avatar {
    background: linear-gradient(135deg, #b87cff, #59c3ff);
}

.message.bot .message-avatar {
    background: rgba(155, 89, 255, 0.2);
    border: 1px solid rgba(155, 89, 255, 0.4);
}

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.message.user .message-content {
    background: linear-gradient(135deg, rgba(155, 89, 255, 0.4), rgba(89, 195, 255, 0.4));
    color: #fff;
    border-radius: 16px 16px 4px 16px;
}

.message.bot .message-content {
    background: rgba(30, 25, 45, 0.8);
    color: rgba(220, 215, 255, 0.95);
    border: 1px solid rgba(155, 89, 255, 0.2);
    border-radius: 16px 16px 16px 4px;
}

/* Chat Links Styling */
.chat-link {
    color: #00d4ff;
    text-decoration: none;
    font-weight: 600;
    position: relative;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 212, 255, 0.1);
    border-bottom: 2px solid rgba(0, 212, 255, 0.3);
    transition: all 0.3s ease;
    display: inline-block;
    margin: 0 2px;
}

.chat-link:hover {
    background: rgba(0, 212, 255, 0.2);
    border-bottom-color: #00d4ff;
    color: #00ffc8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.3);
}

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

/* Alternative link style for internal navigation */
.chat-link.scroll-link {
    color: #b87cff;
    background: rgba(184, 124, 255, 0.1);
    border-bottom-color: rgba(184, 124, 255, 0.3);
}

.chat-link.scroll-link:hover {
    background: rgba(184, 124, 255, 0.2);
    border-bottom-color: #b87cff;
    color: #d4a5ff;
    box-shadow: 0 2px 8px rgba(184, 124, 255, 0.3);
}

/* External link icon */
.chat-link[target="_blank"]::after {
    content: ' ↗';
    font-size: 0.75em;
    opacity: 0.7;
    margin-left: 2px;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    gap: 10px;
    align-items: center;
    padding: 12px 16px;
    background: rgba(30, 25, 45, 0.8);
    border: 1px solid rgba(155, 89, 255, 0.2);
    border-radius: 16px;
    width: fit-content;
    margin-left: 42px;
}

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

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(184, 124, 255, 0.8);
    animation: typing 1.4s ease-in-out infinite;
}

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

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

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

/* Chat Input */
#chat-input-container {
    padding: 16px 20px;
    border-top: 1px solid rgba(155, 89, 255, 0.2);
    display: flex;
    gap: 10px;
}

#chat-input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(155, 89, 255, 0.3);
    background: rgba(10, 8, 20, 0.6);
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    max-height: 100px;
}

#chat-input:focus {
    outline: none;
    border-color: rgba(155, 89, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(155, 89, 255, 0.1);
}

#send-button {
    padding: 12px 16px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, rgba(155, 89, 255, 0.6), rgba(89, 195, 255, 0.6));
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#send-button:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(155, 89, 255, 0.8), rgba(89, 195, 255, 0.8));
    transform: translateY(-2px);
}

#send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#send-button svg {
    width: 20px;
    height: 20px;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 20px;
    color: rgba(220, 215, 255, 0.8);
}

.welcome-message h4 {
    color: #b87cff;
    margin: 0 0 8px 0;
    font-size: 1.1rem;
}

.welcome-message p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.quick-action-btn {
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid rgba(155, 89, 255, 0.3);
    background: rgba(155, 89, 255, 0.1);
    color: rgba(220, 215, 255, 0.9);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.quick-action-btn:hover {
    background: rgba(155, 89, 255, 0.2);
    border-color: rgba(155, 89, 255, 0.5);
    transform: translateX(4px);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 140px);
        right: 20px;
        bottom: 90px;
    }
}