/* ============================================
   Chat Asistente Flotante - Estilo GBM
   Indicador de estado verde
   ============================================ */

.chat-bubble {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    z-index: 1000;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-sm);
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease-out 0.3s backwards;
}

.chat-bubble:hover {
    transform: translateY(-4px);
}

.chat-bubble:hover .bubble-icon {
    box-shadow: var(--shadow-card-hover);
}

.bubble-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.chat-status-indicator {
    position: absolute;
    top: 0;
    right: 0;
    width: 14px;
    height: 14px;
    background: var(--success);
    border: 2px solid var(--bg-card);
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

.bubble-icon {
    width: 56px;
    height: 56px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    font-size: 1.5rem;
    box-shadow: var(--shadow-card);
    transition: all 0.2s ease;
}

.chat-bubble:hover .bubble-icon {
    background: var(--primary-hover);
}

.bubble-text {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: var(--space-md) var(--space-lg);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: center;
    box-shadow: var(--shadow-card);
    white-space: nowrap;
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

.chat-bubble:hover .bubble-text {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-card-hover);
}

/* Modal del Chat con animaciones mejoradas */
.chat-modal {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 400px;
    height: 600px;
    background: transparent;
    z-index: 9999;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-modal.show {
    display: block;
    opacity: 1;
    transform: scale(1) translateY(0);
    animation: scaleIn 0.4s cubic-bezier(0.4, 0, 0.2, 1), fadeInUp 0.4s ease;
}

.chat-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.chat-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.chat-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text);
}

.chat-logo i {
    color: var(--primary);
    font-size: 1.5rem;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #94a3b8;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse 2s infinite;
}

.chat-close-btn {
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    transition: all 0.3s ease;
    font-size: 1.25rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.chat-close-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.6);
    color: #fee2e2;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.chat-close-btn:active {
    transform: rotate(90deg) scale(0.95);
}

.chat-modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

/* Mensajes del chat */
.chat-messages {
    margin-bottom: 1.5rem;
}

.message {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-start;
    animation: slideInRight 0.4s ease-out backwards;
    opacity: 0;
}

.message.user-message {
    animation: slideInLeft 0.4s ease-out backwards;
}

.message.bot-message {
    animation: slideInRight 0.4s ease-out backwards;
}

.message:nth-child(1) { animation-delay: 0.1s; }
.message:nth-child(2) { animation-delay: 0.2s; }
.message:nth-child(3) { animation-delay: 0.3s; }
.message:nth-child(4) { animation-delay: 0.4s; }
.message:nth-child(5) { animation-delay: 0.5s; }

/* Mostrar mensajes con fade in */
.message {
    animation-fill-mode: forwards;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    flex-shrink: 0;
}

.bot-message .message-avatar {
    background: var(--primary);
}

.user-message .message-avatar {
    background: var(--secondary);
}

.message-content {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.message-text {
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.message-time {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* Botones de acción rápida */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.quick-action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.quick-action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.2), transparent);
    transition: left 0.5s;
}

.quick-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.quick-action-btn:hover::before {
    left: 100%;
}

.quick-action-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.quick-action-btn i {
    color: var(--primary);
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.quick-action-btn:hover i {
    transform: scale(1.2) rotate(5deg);
}

/* Área de input del chat */
.chat-input-container {
    margin-top: 1rem;
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.input-wrapper input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.input-wrapper button {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.input-wrapper button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.input-wrapper button:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5), 0 0 25px rgba(99, 102, 241, 0.3);
}

.input-wrapper button:hover::before {
    width: 300px;
    height: 300px;
}

.input-wrapper button:active {
    transform: translateY(-1px) scale(1);
    animation: pulse 0.3s ease;
}

.input-wrapper button i {
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.input-wrapper button:hover i {
    transform: translateX(3px) rotate(15deg);
}
