#chatbot-toggler {
    position: fixed;
    bottom: 30px;
    right: 35px;
    z-index: 2147483647;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    width: 50px;
    cursor: pointer;
    border-radius: 50%;
    background: linear-gradient(135deg, #0C1C31, #4F8CFF);
    transition: all 0.2s ease;
}

body.show-chatbot #chatbot-toggler {
    transform: rotate(90deg);
}

#chatbot-toggler span {
    color: #ffffff;
    position: absolute;
}

#chatbot-toggler .chat-svg {
    display: block;
}

#chatbot-toggler .cross-svg {
    display: none;
}

body.show-chatbot #chatbot-toggler .chat-svg {
    display: none;
}

body.show-chatbot #chatbot-toggler .cross-svg {
    display: block;
}

/* Chatbot Popup */
.chatbot-popup {
    position: fixed;
    right: 5vw;
    bottom: 90px;
    z-index: 2147483647;
    width: 90vw;
    max-width: 490px;
    opacity: 0;
    transform: scale(0.2);
    transform-origin: bottom right;
    pointer-events: none;
    transition: all 0.1s ease;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: hidden;
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15),
    0 10px 25px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideUp 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

body.show-chatbot .chatbot-popup {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #0C1C31 60%, #4F8CFF 100%);
    justify-content: space-between;
    padding: 20px 24px;
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), transparent);
    pointer-events: none;
}

.chat-header .header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1;
}

.header-info .chatbot-logo {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 8px;
    fill: #0B59DB;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.header-info .chatbot-logo:hover {
    transform: rotate(3deg) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.header-info .logo-text {
    font-size: 1.3rem;
    text-align: center;
    font-weight: 800;
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: -0.02em;
}

.chat-header #close-chatbot {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: #ffffff;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.chat-header #close-chatbot:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Chat Body */
.chat-body {
    height: 55vh;
    max-height: 400px;
    overflow-y: auto;
    padding: 24px;
    margin-bottom: 80px;
    gap: 16px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, rgba(248, 250, 252, 0.8), rgba(241, 245, 249, 0.6));
}

.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #0B59DB, #4F8CFF);
    border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8, #6a42a0);
}

.chat-body .message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    animation: fadeInUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-body .bot-message .bot-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #0B59DB, #4F8CFF);
    border-radius: 12px;
    padding: 6px;
    fill: #ffffff;
    align-self: flex-end;
    margin-bottom: 2px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.chat-body .bot-message .bot-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.chat-body .user-message {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chat-body .message .message-text {
    padding: 14px 18px;
    font-size: 0.95rem;
    max-width: 75%;
    line-height: 1.5;
    font-weight: 400;
    word-wrap: break-word;
    position: relative;
}

.chat-body .bot-message.thinking .message-text {
    padding: 8px 18px;
}

.chat-body .bot-message .message-text {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 18px 18px 18px 6px;
    color: #334155;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.chat-body .user-message .message-text {
    background: linear-gradient(135deg, #0B59DB, #4F8CFF);
    border-radius: 18px 18px 6px 18px;
    color: #ffffff;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.chat-body .user-message .attachment {
    width: 50%;
    margin-top: -7px;
    border-radius: 13px 3px 13px 13px;
}

/* Thinking Dots */
.chat-body .bot-message .thinking-indicator {
    display: flex;
    gap: 6px;
    padding-block: 12px;
    align-items: center;
}

.chat-body .bot-message .thinking-indicator .dot {
    height: 8px;
    width: 8px;
    opacity: 0.6;
    border-radius: 50%;
    background: linear-gradient(135deg, #0B59DB, #4F8CFF);
    animation: dotPulse 1.6s ease-in-out infinite;
}

.chat-body .bot-message .thinking-indicator .dot:nth-child(1) {
    animation-delay: 0.1s;
}

.chat-body .bot-message .thinking-indicator .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-body .bot-message .thinking-indicator .dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes dotPulse {
    0%, 60% {
        transform: translateY(0) scale(1);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-8px) scale(1.2);
        opacity: 1;
    }
}

/* Chat Footer */
.chat-footer {
    position: absolute;
    z-index: 10;
    left: 0;
    width: 100%;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(226, 232, 240, 0.5);
}

.chat-footer .chat-form {
    display: flex;
    position: relative;
    flex-direction: row;
    align-items: center;
    background: rgba(248, 250, 252, 0.8);
    border-radius: 24px;
    border: 2px solid rgba(226, 232, 240, 0.6);
    padding: 3px 10px;
    gap: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.chat-footer .chat-form:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 8px 25px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
}

.chat-form .message-input {
    flex: 1;
    height: 44px;
    font-size: 0.95rem;
    padding: 12px 16px;
    border: none;
    outline: none;
    resize: none;
    overflow: hidden;
    background: transparent;
    color: #334155;
    font-weight: 400;
    line-height: 1.4;
}

.chat-form .message-input::placeholder {
    color: #94a3b8;
}

.chat-form .chat-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-form .chat-controls button {
    height: 36px;
    width: 36px;
    border: none;
    cursor: pointer;
    background: rgba(148, 163, 184, 0.1);
    color: #64748b;
    border-radius: 12px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chat-form .chat-controls button:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    transform: scale(1.1);
}

.chat-form .chat-controls #send-message {
    background: linear-gradient(135deg, #667eea 0%, #001aff 100%);
    display: none;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.chat-form .message-input:valid ~ .chat-controls #send-message {
    display: flex;
    animation: bounceIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.chat-form .chat-controls #send-message:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, # #0004f5 100%);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* File Upload */
.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;
    height: 100%;
    width: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.chat-form .file-upload-wrapper :where(img, #file-cancel),
.chat-form .file-upload-wrapper.file-uploaded #file-upload {
    display: block;
}

.chat-form .file-upload-wrapper.file-uploaded img,
.chat-form .file-upload-wrapper.file-uploaded:hover #file-cancel {
    display: none;
}

/* Emoji Picker */
em-emoji-picker {
    position: absolute;
    visibility: hidden;
    left: 50%;
    top: -337px;
    width: 100%;
    max-width: 350px;
    max-height: 330px;
    transform: translateX(-50%);
    z-index: 1000;
}

body.show-emoji-picker em-emoji-picker {
    visibility: hidden;
}

/* Accessibility Focus Styles */
button:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.message-input:focus {
    outline: none;
}

/* Responsive Tweaks */
@media (max-width: 480px) {
    .chat-body {
        padding: 16px;
        margin-bottom: 72px;
    }

    .chat-footer {
        padding: 8px;
    }

    .chat-header {
        padding: 16px;
    }

    .chat-header .logo-text {
        font-size: 1rem;
    }
}

