/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* Chatbot Toggler Button */
.chatbot-toggler {
    position: fixed;
    bottom: 30px;
    right: 35px;
    outline: none;
    border: none;
    height: 60px;
    width: 60px;
    display: flex;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #ca8a04 0%, #a16207 100%);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 24px rgba(161, 98, 7, 0.35);
    z-index: 9999;
}

.chatbot-toggler:hover {
    transform: scale(1.08) rotate(5deg);
    box-shadow: 0 12px 30px rgba(161, 98, 7, 0.45);
}

.chatbot-toggler span {
    color: #fff;
    font-size: 1.8rem;
    position: absolute;
    transition: all 0.3s ease;
}

.chatbot-toggler span:last-child,
body.show-chatbot .chatbot-toggler span:first-child {
    opacity: 0;
    transform: rotate(90deg);
}

body.show-chatbot .chatbot-toggler span:last-child {
    opacity: 1;
    transform: rotate(0);
}

/* Chatbot Window */
.chatbot {
    position: fixed;
    right: 35px;
    bottom: 100px;
    width: 380px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 24px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9) translateY(20px);
    transform-origin: bottom right;
    box-shadow: 0 20px 60px rgba(100, 116, 139, 0.2), 0 0 0 1.5px rgba(203, 213, 225, 0.8);
    backdrop-filter: blur(20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9998;
    font-family: 'Outfit', sans-serif;
}

body.show-chatbot .chatbot {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) translateY(0);
}

/* Header */
.chatbot header {
    background: linear-gradient(135deg, #ca8a04 0%, #a16207 100%);
    padding: 20px 0;
    position: relative;
    text-align: center;
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.chatbot header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0;
}

.chatbot header .close-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    cursor: pointer;
    display: none;
}

/* Chatbox Area */
.chatbot .chatbox {
    overflow-y: auto;
    height: 400px;
    padding: 20px 20px 80px;
    background: #faf7f2;
}

.chatbox .chat {
    display: flex;
    list-style: none;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbox .outgoing {
    justify-content: flex-end;
}

/* Avatars */
.chatbox .incoming span {
    width: 36px;
    height: 36px;
    color: #fff;
    cursor: default;
    text-align: center;
    line-height: 36px;
    align-self: flex-end;
    background: linear-gradient(135deg, #ca8a04 0%, #a16207 100%);
    border-radius: 12px;
    margin: 0 10px 4px 0;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(161, 98, 7, 0.25);
}

/* Message Bubbles */
.chatbox .chat p {
    white-space: pre-wrap;
    padding: 14px 18px;
    border-radius: 18px 18px 18px 4px;
    max-width: 80%;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.chatbox .outgoing p {
    background: linear-gradient(135deg, #ca8a04 0%, #a16207 100%);
    color: #fff;
    border-radius: 18px 18px 4px 18px;
    text-align: left;
}

.chatbox .incoming p {
    background: #ffffff;
    color: #1e2430;
    border: 1.5px solid #cbd5e1;
}

.chatbox .incoming p.error {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fecaca;
}

/* Input Area */
.chatbot .chat-input {
    display: flex;
    gap: 10px;
    position: absolute;
    bottom: 0;
    width: 100%;
    background: #fff;
    padding: 15px 20px;
    border-top: 1.5px solid #cbd5e1;
}

.chat-input textarea {
    height: 50px;
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    max-height: 120px;
    padding: 12px 15px;
    font-size: 0.95rem;
    background: #f1f5f9;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    color: #1e2430;
    transition: all 0.2s;
}

.chat-input textarea:focus {
    background: #fff;
    box-shadow: 0 0 0 2px #ca8a04;
}

.chat-input span {
    align-self: flex-end;
    color: #ca8a04;
    cursor: pointer;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    font-size: 1.6rem;
    background: rgba(202, 138, 4, 0.1);
    width: 50px;
    border-radius: 12px;
    transition: all 0.2s;
}

.chat-input textarea:valid~span {
    visibility: visible;
}

.chat-input span:hover {
    background: #ca8a04;
    color: #fff;
}

/* Mobile Responsiveness */
@media (max-width: 490px) {
    .chatbot {
        right: 0;
        bottom: 0;
        height: 100%;
        border-radius: 0;
        width: 100%;
        max-height: 100vh;
    }

    .chatbot header .close-btn {
        display: block !important;
        font-size: 1.8rem;
        right: 20px;
        padding: 8px;
    }

    .chatbot .chatbox {
        height: calc(100% - 130px);
        padding: 25px 15px 100px;
    }

    .chatbot .chat-input {
        padding: 8px 15px;
    }

    .chatbot header {
        padding: 18px 0;
    }

    .chatbot-toggler {
        bottom: 20px;
        right: 20px;
        width: 52px;
        height: 52px;
    }
}