/* Chat Overlay */
.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chat-overlay.active {
    display: block;
    opacity: 1;
}

/* Chat Toggle Button */
.chat-toggle-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #fff;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 1001;
}

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

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

.chat-toggle-btn.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* AI Chat Container - Hidden by default, slides in from right */
.chat-container {
    position: fixed;
    top: 0;
    right: -25%;
    width: 25%;
    min-width: 300px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: rgba(20, 20, 30, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-container.active {
    right: 0;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header .status {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 6px;
}

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

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

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

@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-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.message-content {
    background: rgba(255, 255, 255, 0.08);
    padding: 14px 18px;
    border-radius: 18px;
    color: #fff;
    line-height: 1.6;
    word-wrap: break-word;
}

.message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
}

.typing-indicator {
    display: none;
    gap: 12px;
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
}

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

.typing-dots {
    background: rgba(255, 255, 255, 0.08);
    padding: 14px 18px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 6px;
}

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

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

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

@keyframes typingAnimation {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }
}

.chat-input-container {
    padding: 20px 30px;
    background: rgba(30, 30, 40, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 8px 8px 8px 20px;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.4);
}

#messageInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 15px;
    padding: 8px 0;
}

#messageInput::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

#sendBtn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

#sendBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#sendBtn:active {
    transform: scale(0.95);
}

#sendBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.6);
}

.welcome-message h2 {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
}

.welcome-message p {
    font-size: 16px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-container {
        width: 100%;
        right: -100%;
        min-width: unset;
    }

    .chat-header {
        padding: 15px 20px;
    }

    .chat-header h1 {
        font-size: 18px;
    }

    .chat-messages {
        padding: 20px 15px;
    }

    .message {
        max-width: 90%;
    }

    .chat-input-container {
        padding: 15px;
    }

    .chat-toggle-btn {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
    }
}
