/* ==========================================================================
   MODERN AI CHATBOT STYLES
   ========================================================================== */

:root {
    --chat-window-width: 340px;
    --chat-window-height: 460px;
}

/* Floating Toggle Button */
.chat-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(44, 76, 59, 0.4);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 40px rgba(44, 76, 59, 0.5);
}

.chat-toggle svg {
    width: 30px;
    height: 30px;
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: var(--chat-window-width);
    height: var(--chat-window-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(30px) scale(0.9);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.chat-header {
    background: var(--primary);
    padding: 20px;
    border-radius: 20px 20px 0 0;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.chat-header h3 {
    font-size: 1.1rem;
    margin: 0;
    font-family: var(--font-heading);
}

.chat-header span {
    font-size: 0.8rem;
    opacity: 0.8;
}

.close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.close-chat:hover {
    opacity: 1;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(248, 246, 240, 0.5);
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
    background: white;
    color: var(--text-dark);
    border-bottom-left-radius: 2px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
}

.message.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 2px;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-self: flex-start;
    padding: 12px 16px;
    background: white;
    border-radius: 15px;
    border-bottom-left-radius: 2px;
    gap: 5px;
}

.dot {
    width: 6px;
    height: 6px;
    background: #ccc;
    border-radius: 50%;
    animation: dotPulse 1.5s infinite;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.4;
    }

    50% {
        transform: scale(1.3);
        opacity: 1;
    }
}

/* Input Area */
.chat-input-area {
    padding: 20px;
    background: white;
    border-radius: 0 0 20px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid #eee;
}

.chat-input-area input {
    flex: 1;
    border: none;
    padding: 10px;
    font-size: 0.95rem;
    background: #f8f8f8;
    border-radius: 25px;
    outline: none;
    font-family: var(--font-body);
}

.voice-btn,
.send-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.voice-btn:hover,
.send-btn:hover {
    transform: scale(1.1);
}

.voice-btn.recording {
    color: red;
    animation: recPulse 1s infinite;
}

@keyframes recPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .chat-toggle {
        width: 55px;
        height: 55px;
        bottom: 20px;
        right: 20px;
    }

    .chat-window {
        width: calc(100% - 40px);
        height: min(500px, 80vh);
        right: 20px;
        bottom: 85px;
    }

    .chat-messages {
        padding: 15px;
    }
}