/* Chatbot Litoral Trading */
.chatbot-float-btn {
    position: fixed;
    bottom: 105px;
    right: 30px;
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    color: #fff;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
    z-index: 1000;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1.6rem;
}

.chatbot-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff3b30;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid #fff;
    animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 100px;
    width: 380px;
    height: 520px;
    max-height: calc(100dvh - 120px);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    resize: both;
    min-width: 320px;
    min-height: 420px;
    max-width: calc(100vw - 30px);
    z-index: 10000;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
}

.chatbot-closed {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    visibility: hidden;
}

.chatbot-header {
    background: #0f172a;
    color: #fff;
    padding: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #10b981;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 0;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
}

.chatbot-details {
    min-width: 0;
}

.chatbot-details h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.chatbot-status {
    font-size: 0.75rem;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.chatbot-status-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #10b981;
}

.chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chatbot-header-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s, opacity 0.3s;
    opacity: 0.7;
}

.chatbot-header-btn:hover {
    opacity: 1;
    color: #10b981;
}

.chatbot-close-btn {
    font-size: 1.8rem;
}

.chatbot-messages {
    flex: 1;
    padding: 1.2rem;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: #1e293b;
    scrollbar-width: thin;
}

.chatbot-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    min-width: 0;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chatbot-msg-received {
    align-self: flex-start;
}

.chatbot-msg-sent {
    align-self: flex-end;
}

.chatbot-msg-bubble {
    box-sizing: border-box;
    max-width: 100%;
    padding: 0.8rem 1.1rem;
    font-size: 0.9rem;
    line-height: 1.4;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    overflow-wrap: anywhere;
    word-break: normal;
}

.chatbot-msg-bubble a {
    color: #60a5fa;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.chatbot-msg-received .chatbot-msg-bubble {
    background-color: #334155;
    color: #f8fafc;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chatbot-msg-sent .chatbot-msg-bubble {
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
    font-weight: 500;
}

.chatbot-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.4rem 0.2rem;
    align-items: center;
    justify-content: center;
}

.chatbot-typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: #94a3b8;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.chatbot-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.chatbot-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.chatbot-input-form {
    display: flex;
    padding: 0.8rem;
    background-color: #0f172a;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    gap: 0.5rem;
}

.chatbot-input-form input {
    flex: 1;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 0.7rem 1.2rem;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s, background-color 0.3s, box-shadow 0.3s;
    background-color: #1e293b;
    color: #fff;
}

.chatbot-input-form input:focus {
    border-color: #10b981;
    background-color: #0f172a;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.chatbot-input-form button {
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    font-size: 1rem;
}

.chatbot-input-form button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

@media (max-width: 480px) {
    .chatbot-container {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100dvh;
        max-height: 100%;
        max-width: 100%;
        min-width: 0;
        min-height: 0;
        resize: none;
        border-radius: 0;
        border: none;
    }

    .chatbot-closed {
        transform: translateY(100%) scale(1);
    }

    .chatbot-input-form {
        padding-right: calc(0.8rem + 76px + env(safe-area-inset-right));
    }

    .chatbot-float-btn {
        bottom: 100px;
        right: 20px;
    }
}
