@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;800&display=swap');

:root {
    --primary-color: #4b0082; /* Deep Decepticon Purple */
    --secondary-color: #1c1c1c; /* Dark Gray Backgrounds */
    --background-gradient-start: #0a0a0a;
    --background-gradient-end: #1e0033;
    --font-family: 'Orbitron', sans-serif;
    --chatbot-shadow: rgba(138, 43, 226, 0.15); /* Subtle neon glow */
    --chatbot-shadow-strong: rgba(138, 43, 226, 0.5);
    --scrollbar-color: #6a0dad;
    --hover-color: #8000ff;
    --cancel-color: #ff0033;
    --white-color: #e0e0ff;
    --border-radius: 8px;
    --transition-duration: 0.2s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    min-height: 100vh;
    background: linear-gradient(var(--background-gradient-start), var(--background-gradient-end));
}

#chatbot-toggler {
    position: fixed;
    bottom: 30px;
    right: 35px;
    height: 50px;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

body.show-chatbot #chatbot-toggler {
    transform: rotate(90deg);
}

#chatbot-toggler span {
    color: var(--white-color);
    position: absolute;
}

body.show-chatbot #chatbot-toggler span:first-child,
#chatbot-toggler span:last-child {
    opacity: 0;
}

body.show-chatbot #chatbot-toggler span:last-child {
    opacity: 1;
}

.chatbot-popup {
    position: fixed;
    right: 35px;
    bottom: 90px;
    width: 420px;
    background: var(--secondary-color);
    overflow: hidden;
    opacity: 0;
    transform: scale(0.2);
    transform-origin: bottom right;
    pointer-events: none;
    border-radius: 15px;
    box-shadow: 0 0 128px var(--chatbot-shadow),
                0 32 -48px var(--chatbot-shadow-strong);
    transition: all 0.1s ease;
    display: flex;
    flex-direction: column;
    height: 600px; /* or your preferred height */
}

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

.chat-header {
    display: flex;
    align-items: center;
    background: var(--primary-color);
    padding: 15px 22px;
    justify-content: space-between;
}

.chat-header .header-info {
    display: flex;
    gap: 10px;
    align-items: center;
}

.header-info .chatbot-logo {
    height: 35px;
    width: 35px;
    padding: 6px;
    fill: var(--primary-color);
    flex-shrink: 0;
    background: var(--white-color);
    border-radius: 50%;
}

.header-info .logo-text {
    color: var(--white-color);
    font-size: 1.31rem;
    font-weight: 600;
}

.chat-header #close-chatbot {
    border: none;
    color: var(--white-color);
    height: 40px;
    width: 40px;
    font-size: 1.9rem;
    margin-right: -10px;
    padding-top: 2px;
    cursor: pointer;
    border-radius: 50%;
    background: none;
    transition: 0.3s ease;
}

.chat-header #close-chatbot:hover {
    background: var(--primary-color);
}

.chat-body {
    padding: 25px 22px;
    display: flex;
    gap: 20px;
    flex: 1 1 auto;
    overflow-y: auto;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-color) transparent;
    margin-bottom: 0;
    height: auto;
}

.chat-body .message {
    display: flex;
    gap: 11px;
    align-items: center;
}

.chat-body .bot-message .bot-avatar {
    height: 35px;
    width: 35px;
    padding: 6px;
    fill: var(--white-color);
    flex-shrink: 0;
    background: var(--primary-color);
    border-radius: 50%;
    margin-bottom: 2px;
}

.chat-body .user-message {
    flex-direction: column;
    align-items: flex-end;
}

.chat-body .message .message-text {
    padding: 12px 16px;
    max-width: 75%;
    font-size: 0.95rem;
    color: var(--white-color);
}

.chat-body .bot-message.thinking .message-text {
    padding: 2px 16px;
}

.chat-body .bot-message .message-text {
    background: var(--scrollbar-color);
    border-radius: 13px 13px 13px 3px;
}

.chat-body .user-message .message-text {
    color: var(--white-color);
    background: var(--primary-color);
    border-radius: 13px 13px 3px 13px;
}

.chat-body .user-message .attachment {
    width: 50%;
    margin-top: -7px;
    border-radius: 13px 3px 13px 13px;
}

.chat-body .user-message .thinking-indicator {
    display: flex;
    gap: 4px;
    padding-block: 15px;
}

.chat-body .user-message .thinking-indicator .dot {
    width: 7px;
    height: 7px;
    opacity: 0.7;
    border-radius: 50%;
    background: var(--primary-color);
    animation: dotPulse 1.8s ease-in-out infinite;
}

.chat-body .user-message .thinking-indicator .dot:nth-child(1) {
    animation-delay: 0.2s;
}

.chat-body .user-message .thinking-indicator .dot:nth-child(2) {
    animation-delay: 0.3s;
}

.chat-body .user-message .thinking-indicator .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotPulse {
    0%, 44% {
        transform: translateY(0);
    }

    28% {
        opacity: 0.4;
        transform: translateY(-4px);
    }

    44% {
        opacity: 0.2;
    }
}

.chat-body::-webkit-scrollbar {
    width: 8px;
    background: transparent;
}

.chat-body::-webkit-scrollbar-thumb {
    background: var(--scrollbar-color);
    border-radius: 8px;
}

.chat-footer {
    position: relative;
    bottom: 0;
    width: 100%;
    background: var(--secondary-color);
    padding: 15px 22px 20px;
    z-index: 2;
}

.chat-footer .chat-form {
    display: flex;
    position: relative;
    align-items: center;
    outline: 1px solid #cccce5;
    background: #ffffff;
    border-radius: 32px;
}

.chat-footer .chat-form:focus-within {
    outline: 2px solid var(--primary-color);
}

.chat-form .message-input {
    width: 100%;
    padding: 14px 0 13px 18px;
    border: none;
    overflow: hidden;
    outline: none;
    font-size: 0.95rem;
    border-radius: inherit;
    height: 47px;
    resize: none;
    max-height: 180px;
    white-space: pre-line;
    scrollbar-color: transparent transparent;
    scrollbar-width: thin;
}

.chat-form .message-input:hover {
    scrollbar-color: var(--scrollbar-color) transparent;
}

.chat-form .chat-controls {
    display: flex;
    height: 47px;
    align-items: center;
    align-self: flex-end;
    padding-right: 6px;
    gap: 3px;
}

.chat-form .chat-controls #send-message {
    display: none;
    color: var(--white-color);
    background: var(--primary-color);
}

.chat-form .message-input:valid ~ .chat-controls #send-message {
    display: block;
}

.chat-form .chat-controls #send-message:hover {
    background: var(--hover-color);
}

.chat-form .chat-controls button {
    border: none;
    background: none;
    cursor: pointer;
    height: 35px;
    width: 35px;
    color: #706DB0;
    border-radius: 50%;
    font-size: 1.15rem;
    transition: 0.2s ease;
}

.chat-form .chat-controls button:hover {
    background: #f1f1ff;
}

.chat-form .file-upload-wrapper {
    height: 35px;
    width: 35px;
    position: relative;
}

.chat-form .file-upload-wrapper :where(img, button) {
    position: absolute;
}

.chat-form .file-upload-wrapper img {
    display: none; /* Hidden by default */
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.chat-form .file-upload-wrapper.file-uploaded img {
    display: block; /* Visible when file-uploaded class is added */
}

.chat-form .file-upload-wrapper #file-cancel {
    color: var(--cancel-color);
    background: var(--secondary-color);
}

.chat-form .file-upload-wrapper :where(img, #file-cancel),
.chat-form .file-upload-wrapper.file-uploaded #file-upload {
    display: none;
}

.chat-form .file-upload-wrapper.file-uploaded img,
.chat-form .file-upload-wrapper.file-uploaded:hover #file-cancel {
    display: block;
}

em-emoji-picker {
    position: absolute;
    left: 50%;
    top: -337px;
    width: 100%;
    max-width: 350px;
    max-height: 330px;
    visibility: hidden;
    transform: translateX(-50%);
}

body.show-emoji-picker em-emoji-picker {
    visibility: visible;
}