/* css/assistant.css */
/* Premium Assistant Chatbot Styles */

.assistant-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-color, #A0715B);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(160, 113, 91, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s, box-shadow 0.2s;
    padding: 0;
    overflow: hidden;
}

.assistant-fab:hover {
    transform: scale(1.1) rotate(5deg);
    background-color: var(--primary-hover, #8C5E49);
    box-shadow: 0 8px 24px rgba(160, 113, 91, 0.45);
}

.assistant-fab:active {
    transform: scale(0.95);
}

/* Badge indicativo de mensaje pendiente */
.assistant-fab-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background-color: #E53E3E;
    border: 2px solid white;
    border-radius: 50%;
    animation: fabPulse 2s infinite;
}

@keyframes fabPulse {
    0% { transform: scale(0.8); box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(229, 62, 62, 0); }
    100% { transform: scale(0.8); box-shadow: 0 0 0 0 rgba(229, 62, 62, 0); }
}

/* Ventana de Chat */
.assistant-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 360px;
    height: 520px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.90);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    overflow: hidden;
    transform: translateY(30px) scale(0.92);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.assistant-chat-window.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Cabecera */
.assistant-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary-color, #A0715B), var(--primary-hover, #8C5E49));
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.assistant-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.assistant-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    overflow: hidden;
    padding: 0;
}

.assistant-info h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.assistant-status {
    font-size: 11px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 4px;
}

.assistant-status::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #48BB78;
    border-radius: 50%;
}

.assistant-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.assistant-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

/* Área de conversación */
.assistant-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: rgba(253, 252, 249, 0.4);
}

.assistant-messages::-webkit-scrollbar {
    width: 6px;
}
.assistant-messages::-webkit-scrollbar-track {
    background: transparent;
}
.assistant-messages::-webkit-scrollbar-thumb {
    background: rgba(160, 113, 91, 0.2);
    border-radius: 10px;
}
.assistant-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(160, 113, 91, 0.4);
}

/* Burbujas */
.assistant-msg {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.45;
    word-wrap: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    animation: msgFadeIn 0.25s ease-out forwards;
    box-sizing: border-box;
}

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

.assistant-msg.client {
    align-self: flex-end;
    background-color: var(--primary-color, #A0715B);
    color: white;
    border-bottom-right-radius: 4px;
    max-width: 85%;
}

.assistant-msg.bot {
    align-self: flex-start;
    background-color: white;
    color: var(--text-main, #2D3748);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom-left-radius: 4px;
    white-space: pre-line;
    width: 100%;
    max-width: 100%;
}

.assistant-msg.system {
    align-self: center;
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-muted, #718096);
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 10px;
    box-shadow: none;
}

/* Botones de acción incrustados */
.chat-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 10px;
    padding: 8px 12px;
    background-color: var(--bg-color, #FDFCF9);
    border: 1px solid var(--primary-color, #A0715B);
    color: var(--primary-color, #A0715B);
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, transform 0.1s;
}

.chat-action-btn:hover {
    background-color: var(--primary-color, #A0715B);
    color: white;
    transform: translateY(-1px);
}

.chat-action-btn:active {
    transform: translateY(0);
}

/* Indicador de Escritura */
.typing-indicator-container {
    display: none;
    align-self: flex-start;
    background-color: white;
    padding: 12px 16px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    margin-bottom: 4px;
}

.typing-indicator-container.active {
    display: flex;
    align-items: center;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    background-color: var(--text-muted, #718096);
    border-radius: 50%;
    display: inline-block;
    animation: typingBounce 1.4s infinite ease-in-out both;
    opacity: 0.4;
}

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

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

/* Chips de Sugerencia */
.assistant-suggestion-chips {
    padding: 8px 16px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    background-color: rgba(253, 252, 249, 0.4);
    border-top: 1px solid rgba(0, 0, 0, 0.03);
    scrollbar-width: none; /* Firefox */
}

.assistant-suggestion-chips::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.suggestion-chip {
    padding: 6px 12px;
    background-color: white;
    border: 1px solid rgba(160, 113, 91, 0.2);
    color: var(--text-main, #2D3748);
    font-family: var(--font-main);
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 50px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    transition: border-color 0.2s, background-color 0.2s, transform 0.15s;
}

.suggestion-chip:hover {
    border-color: var(--primary-color, #A0715B);
    background-color: rgba(160, 113, 91, 0.05);
    transform: translateY(-1px);
}

/* Entrada de Texto */
.assistant-input-area {
    padding: 12px 16px;
    background-color: white;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
}

.assistant-input {
    flex: 1;
    border: 1.5px solid #E2E8F0;
    border-radius: 12px;
    padding: 10px 14px;
    font-family: var(--font-main);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.assistant-input:focus {
    border-color: var(--primary-color, #A0715B);
}

.assistant-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background-color: var(--primary-color, #A0715B);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
}

.assistant-send-btn:hover {
    background-color: var(--primary-hover, #8C5E49);
}

.assistant-send-btn:active {
    transform: scale(0.95);
}

.assistant-send-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Responsividad Móvil */
@media (max-width: 768px) {
    .assistant-fab {
        bottom: 86px; /* Para no tapar la navegación inferior */
        right: 16px;
        width: 56px;
        height: 56px;
        font-size: 24px;
    }

    .assistant-chat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        z-index: 100000;
        border: none;
    }
    
    .assistant-header {
        padding: 14px 16px;
    }
}
