/* ==========================================================================
   Chatbot Premium Glassmorphism Design
   ========================================================================== */

.chatbot-wrapper {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    font-family: var(--font-body);
}

/* Chat Toggle Button */
.chat-toggle {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--clr-accent-primary), var(--clr-accent-secondary));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 1.8rem;
    box-shadow: 0 10px 30px rgba(0, 255, 102, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.chat-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 40px rgba(0, 255, 102, 0.6);
}

.chat-toggle .close-icon {
    display: none;
}

.chat-toggle.active .chat-icon {
    display: none;
}

.chat-toggle.active .close-icon {
    display: block;
}

/* Notification Badge */
.chat-badge {
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: #ff3366;
    border-radius: 50%;
    border: 3px solid var(--clr-bg-base);
    animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 380px;
    height: 550px;
    background: rgba(20, 20, 25, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    transform: translateY(20px) scale(0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom right;
}

.chat-window.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

/* Chat Header */
.chat-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(0, 255, 102, 0.1), rgba(0, 168, 255, 0.1));
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-avatar {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: var(--clr-bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--clr-accent-primary);
}

.chat-avatar img {
    width: 30px;
}

.chat-header-info h4 {
    font-size: 1.1rem;
    margin-bottom: 2px;
    color: #fff;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: var(--clr-accent-primary);
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--clr-accent-primary);
    border-radius: 50%;
    box-shadow: 0 0 5px var(--clr-accent-primary);
}

/* Messages Area */
.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    scrollbar-width: thin;
    scrollbar-color: var(--clr-accent-primary) transparent;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--clr-accent-primary);
    border-radius: 10px;
}

.message {
    max-width: 80%;
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    animation: messageIn 0.3s ease-out;
}

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

.message-bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-bottom-left-radius: 4px;
}

.message-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--clr-accent-primary), var(--clr-accent-secondary));
    color: #000;
    font-weight: 500;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.5;
    margin-top: 5px;
    display: block;
}

.message-user .message-time {
    color: rgba(0, 0, 0, 0.5);
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    display: none;
}

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

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--clr-text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* Chat Input */
.chat-input-area {
    padding: 1.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.chat-input:focus {
    border-color: var(--clr-accent-primary);
}

.send-btn {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: var(--clr-accent-primary);
    border: none;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.send-btn:hover {
    transform: scale(1.05);
    background: #00e65c;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: -10px;
    }
    
    .chatbot-wrapper {
        bottom: 20px;
        right: 20px;
    }
}
