/* Chat Widget Styles */
#chat-widget-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

#chat-widget-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0f5238, #1a7a55);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(15, 82, 56, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

#chat-widget-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(15, 82, 56, 0.6);
}

#chat-widget-button .material-symbols-outlined {
    font-size: 30px;
}

#chat-widget-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    max-height: calc(100vh - 120px);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(191, 201, 193, 0.3);
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom right;
}

#chat-widget-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

#chat-widget-header {
    padding: 20px;
    background: linear-gradient(135deg, #0f5238, #1a7a55);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
}

#chat-widget-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

#chat-widget-header p {
    margin: 4px 0 0;
    font-size: 0.8rem;
    opacity: 0.9;
    font-weight: 300;
}

#chat-widget-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

#chat-widget-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

#chat-widget-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
    animation: slideIn 0.3s ease forwards;
    opacity: 0;
}

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

.chat-message.user {
    align-self: flex-end;
    background: #0f5238;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.bot {
    align-self: flex-start;
    background: #fdfae7;
    color: #1a1a1a;
    border: 1px solid rgba(191, 201, 193, 0.3);
    border-bottom-left-radius: 4px;
}

#chat-widget-typing {
    align-self: flex-start;
    background: #fdfae7;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(191, 201, 193, 0.3);
    display: none;
    align-items: center;
    gap: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: #0f5238;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

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

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

#chat-widget-input-area {
    padding: 16px;
    background: rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(191, 201, 193, 0.3);
    display: flex;
    gap: 10px;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
}

#chat-widget-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid rgba(191, 201, 193, 0.5);
    border-radius: 24px;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    background: white;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#chat-widget-input:focus {
    border-color: #0f5238;
    box-shadow: 0 0 0 3px rgba(15, 82, 56, 0.1);
}

#chat-widget-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #0f5238;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

#chat-widget-send:hover {
    background: #1a7a55;
    transform: scale(1.05);
}

#chat-widget-send:disabled {
    background: #bfc9c1;
    cursor: not-allowed;
    transform: none;
}

/* Scrollbar para el chat */
#chat-widget-messages::-webkit-scrollbar {
    width: 6px;
}
#chat-widget-messages::-webkit-scrollbar-track {
    background: transparent;
}
#chat-widget-messages::-webkit-scrollbar-thumb {
    background: rgba(191, 201, 193, 0.5);
    border-radius: 3px;
}
#chat-widget-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 82, 56, 0.5);
}

@media (max-width: 480px) {
    #chat-widget-panel {
        width: calc(100vw - 48px);
        bottom: 80px;
        right: 0;
    }
}
