/* ===== CHATBOT FLOATING BUTTON & WIDGET ===== */
.chatbot-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(26, 58, 92, 0.4);
    transition: all var(--transition);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    background: var(--primary-light);
}

.chatbot-toggle .chat-close {
    display: none;
}

.chatbot-toggle.open .chat-icon {
    display: none;
}

.chatbot-toggle.open .chat-close {
    display: inline;
}

/* Chatbot Window */
.chatbot-widget {
    position: fixed;
    bottom: 6rem;
    right: 2rem;
    width: 380px;
    max-width: calc(100vw - 2rem);
    max-height: 70vh;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chatbot-widget.open {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
.chat-header {
    background: var(--primary);
    color: var(--white);
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-header-left .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.chat-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.chat-header p {
    font-size: 0.7rem;
    opacity: 0.8;
    margin: 0;
}

.chat-close-btn {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.7;
    transition: opacity var(--transition);
}

.chat-close-btn:hover {
    opacity: 1;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    background: #f8f9fa;
    max-height: 350px;
    min-height: 250px;
}

.chat-message {
    display: flex;
    margin-bottom: 0.75rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.bot {
    justify-content: flex-start;
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-bubble {
    max-width: 80%;
    padding: 0.6rem 1rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-message.bot .chat-bubble {
    background: var(--white);
    color: var(--text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.chat-message.user .chat-bubble {
    background: var(--primary);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.chat-message .timestamp {
    font-size: 0.6rem;
    opacity: 0.5;
    display: block;
    margin-top: 0.2rem;
}

/* Quick Reply Buttons */
.chat-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem 1rem 0;
}

.chat-quick-reply {
    background: var(--bg);
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 0.25rem 0.8rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text);
}

.chat-quick-reply:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Chat Input */
.chat-input-area {
    display: flex;
    padding: 0.75rem 1rem;
    border-top: 1px solid #eee;
    background: var(--white);
    gap: 0.5rem;
}

.chat-input-area input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition);
}

.chat-input-area input:focus {
    border-color: var(--primary);
}

.chat-input-area button {
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1rem;
    cursor: pointer;
    transition: background var(--transition);
    flex-shrink: 0;
}

.chat-input-area button:hover {
    background: var(--primary-light);
}

/* Typing indicator */
.chat-typing {
    display: flex;
    gap: 4px;
    padding: 0.3rem 1rem;
}

.chat-typing span {
    width: 8px;
    height: 8px;
    background: #aaa;
    border-radius: 50%;
    animation: typing 1.4s infinite both;
}

.chat-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .chatbot-widget {
        bottom: 5rem;
        right: 0.5rem;
        left: 0.5rem;
        width: auto;
        max-height: 60vh;
    }
    .chatbot-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.4rem;
        bottom: 1rem;
        right: 1rem;
    }
    .chat-messages {
        max-height: 250px;
        min-height: 180px;
    }
}

/* Chat notification badge */
.chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e17055;
    color: var(--white);
    font-size: 0.6rem;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
}

.chatbot-toggle .badge-container {
    position: relative;
}