/*--------------------------------------------------------------
# Chatbot - Kriptogram AI Assistant
--------------------------------------------------------------*/

/* Chat Bubble - Fixed Position */
.chatbot-bubble {
    position: fixed;
    right: 25px;
    bottom: 25px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--debian-red) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: chatbot-pulse 2s infinite;
}

.chatbot-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(215, 10, 83, 0.5);
}

.chatbot-bubble i {
    font-size: 26px;
    color: #fff;
    transition: transform 0.3s ease;
}

.chatbot-bubble:hover i {
    transform: rotate(15deg);
}

.chatbot-bubble.active {
    animation: none;
    transform: rotate(0);
}

.chatbot-bubble.active i::before {
    content: "\F62A";
    /* bi-x-lg */
}

@keyframes chatbot-pulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    }

    50% {
        box-shadow: 0 4px 30px rgba(215, 10, 83, 0.6), 0 0 0 10px rgba(37, 99, 235, 0.1);
    }
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    right: 25px;
    bottom: 100px;
    width: 400px;
    height: 550px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 16px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.chatbot-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2) 0%, rgba(215, 10, 83, 0.2) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.chat-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--debian-red) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-avatar i {
    font-size: 20px;
    color: #fff;
}

.chat-header-text h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    font-family: "Space Grotesk", sans-serif;
}

.chat-header-text span {
    font-size: 12px;
    color: var(--accent-color);
    font-family: "Ubuntu Mono", monospace;
}

.chat-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.chat-close:hover {
    color: var(--debian-red);
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
}

/* Message Bubbles */
.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-family: "Ubuntu Mono", monospace;
    font-size: 14px;
    line-height: 1.5;
    animation: messageSlide 0.3s ease;
}

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

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

.chat-message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    border-bottom-left-radius: 4px;
}

.chat-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1d4ed8 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    max-width: 80px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Chat Input Area */
.chat-input-area {
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input-area textarea {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: #fff;
    font-family: "Ubuntu Mono", monospace;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 44px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-area textarea::placeholder {
    color: #94a3b8;
}

.chat-input-area textarea:focus {
    border-color: var(--primary-color);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--debian-red) 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Contact Form Mode */
.contact-form-mode {
    padding: 20px;
    display: none;
    flex-direction: column;
    gap: 12px;
}

.contact-form-mode.active {
    display: flex;
}

.contact-form-mode h5 {
    color: #fff;
    font-size: 16px;
    margin: 0 0 8px 0;
    font-family: "Space Grotesk", sans-serif;
}

.contact-form-mode input,
.contact-form-mode textarea {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px 16px;
    color: #fff;
    font-family: "Ubuntu Mono", monospace;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.contact-form-mode input::placeholder,
.contact-form-mode textarea::placeholder {
    color: #94a3b8;
}

.contact-form-mode input:focus,
.contact-form-mode textarea:focus {
    border-color: var(--primary-color);
}

.contact-form-mode textarea {
    resize: none;
    min-height: 80px;
}

.contact-form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.contact-form-buttons button {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    font-family: "Ubuntu Mono", monospace;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.contact-form-buttons .cancel-btn {
    background: rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
}

.contact-form-buttons .cancel-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.contact-form-buttons .submit-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--debian-red) 100%);
    color: #fff;
}

.contact-form-buttons .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

/* Success/Error States */
.form-status {
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    display: none;
}

.form-status.success {
    display: block;
    background: rgba(16, 185, 129, 0.25);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.form-status.error {
    display: block;
    background: rgba(239, 68, 68, 0.25);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chatbot-bubble {
        right: 15px;
        bottom: 15px;
        width: 55px;
        height: 55px;
    }

    .chatbot-bubble i {
        font-size: 22px;
    }

    .chatbot-window {
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .chatbot-window.active {
        border-radius: 0;
    }
}

/* Hide bubble when chat is open on mobile */
@media (max-width: 480px) {
    .chatbot-bubble.active {
        display: none;
    }
}

/* Ensure chatbot doesn't overlap with back-to-top */
.back-to-top {
    right: 100px;
}

@media (max-width: 480px) {
    .back-to-top {
        right: 15px;
        bottom: 80px;
    }
}