/* ============================================
   JUSTIVEL ABOGADOS - ChatBot Widget
   ============================================ */

/* Chat Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #C5A059 0%, #D8B368 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(197, 160, 89, 0.5);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: chatPulse 2s infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(197, 160, 89, 0.7);
}

.chatbot-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.chatbot-toggle .close-icon {
    display: none;
}

.chatbot-toggle.active .chat-icon {
    display: none;
}

.chatbot-toggle.active .close-icon {
    display: block;
    fill: white;
}

.chatbot-toggle.active {
    background: linear-gradient(135deg, #0B1D3A 0%, #15325C 100%);
    box-shadow: 0 4px 20px rgba(11, 29, 58, 0.4);
    animation: none;
}

@keyframes chatPulse {
    0% {
        box-shadow: 0 4px 20px rgba(197, 160, 89, 0.5);
    }

    50% {
        box-shadow: 0 4px 30px rgba(197, 160, 89, 0.8), 0 0 0 12px rgba(197, 160, 89, 0.15);
    }

    100% {
        box-shadow: 0 4px 20px rgba(197, 160, 89, 0.5);
    }
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    bottom: 170px;
    right: 25px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Century Schoolbook', 'Georgia', serif;
    animation: chatSlideUp 0.3s ease;
}

.chatbot-window.open {
    display: flex;
}

@keyframes chatSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #0B1D3A 0%, #15325C 100%);
    color: white;
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.chatbot-header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    padding: 4px;
}

.chatbot-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.chatbot-header-avatar svg {
    width: 24px;
    height: 24px;
    fill: #C5A059;
}

.chatbot-header-info h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: white;
}

.chatbot-header-info p {
    margin: 0;
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Messages area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    background: #f8f9fa;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Bubbles */
.chat-bubble {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    animation: bubbleFade 0.3s ease;
}

@keyframes bubbleFade {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-bubble.bot {
    background: white;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chat-bubble.user {
    background: linear-gradient(135deg, #0B1D3A 0%, #15325C 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Service buttons */
.chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-width: 85%;
    align-self: flex-start;
    animation: bubbleFade 0.3s ease;
}

.chat-option-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #0B1D3A;
    background: white;
    color: #0B1D3A;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.chat-option-btn:hover {
    background: #0B1D3A;
    color: white;
}

/* Final CTA buttons */
.chat-cta-btns {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 85%;
    align-self: flex-start;
    animation: bubbleFade 0.3s ease;
}

.chat-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.2rem;
    border-radius: 12px;
    text-decoration: none;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
}

.chat-cta-btn.whatsapp {
    background: #25D366;
    color: white;
}

.chat-cta-btn.whatsapp:hover {
    background: #1fb855;
}

.chat-cta-btn.schedule {
    background: #C5A059;
    color: white;
}

.chat-cta-btn.schedule:hover {
    background: #b08d47;
}

/* Input area */
.chatbot-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
    border-top: 1px solid #e2e8f0;
    background: white;
}

.chatbot-input input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input input:focus {
    border-color: #0B1D3A;
}

.chatbot-input button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #0B1D3A;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chatbot-input button:hover {
    background: #15325C;
}

.chatbot-input button svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.chatbot-input.disabled input {
    background: #f1f5f9;
    pointer-events: none;
}

.chatbot-input.disabled button {
    background: #94a3b8;
    pointer-events: none;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.75rem 1rem;
    align-self: flex-start;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: typingBounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-8px);
    }
}

/* Mobile */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 10px;
        left: 10px;
        border-radius: 12px;
    }
}