/* ========================================
   MAX AI ASSISTANT - PERRO ROBOT
   Botón flotante y chat interface
   ======================================== */

/* Botón flotante de Max */
.max-assistant {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.max-button {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #818cf8);
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.max-button:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 12px 32px rgba(79, 70, 229, 0.6);
}

.max-button:active {
    transform: translateY(-2px) scale(1.05);
}

/* Animación de pulso */
.max-button::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0;
    }
}

/* Icono del perro robot */
.max-icon {
    font-size: 2rem;
    position: relative;
    z-index: 1;
    animation: bounce 3s ease-in-out infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Badge de notificación */
.max-notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ef4444;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badgePulse 1.5s ease-in-out infinite;
}

@keyframes badgePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* Chat Window */
.max-chat-window {
    position: fixed;
    bottom: 120px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999;
    animation: slideUp 0.3s ease;
}

.max-chat-window.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header del chat */
.max-chat-header {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    padding: 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.max-avatar {
    width: 45px;
    height: 45px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.max-info h3 {
    margin: 0;
    font-size: 1.1rem;
    color: white;
}

.max-status {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: statusBlink 2s ease-in-out infinite;
}

@keyframes statusBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.max-close {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.max-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Area */
.max-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.max-message {
    display: flex;
    gap: 0.75rem;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.max-message.user {
    flex-direction: row-reverse;
}

.max-message .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.max-message.user .avatar {
    background: var(--success);
}

.message-bubble {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.75rem 1rem;
    border-radius: 15px;
    max-width: 75%;
    word-wrap: break-word;
}

.max-message.user .message-bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

.message-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Quick Actions */
.max-quick-actions {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.quick-action-btn {
    padding: 0.5rem 1rem;
    background: rgba(79, 70, 229, 0.1);
    border: 1px solid var(--primary);
    border-radius: 20px;
    color: var(--primary-light);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-action-btn:hover {
    background: rgba(79, 70, 229, 0.2);
    transform: translateY(-2px);
}

/* Input Area */
.max-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
}

.max-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-size: 0.9rem;
}

.max-input-area input:focus {
    outline: none;
    border-color: var(--primary);
}

.max-send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.max-send-btn:hover {
    transform: scale(1.1);
}

.max-send-btn:active {
    transform: scale(0.95);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.7;
    }

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 640px) {
    .max-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 140px);
        right: 10px;
        bottom: 100px;
    }

    .max-button {
        width: 60px;
        height: 60px;
    }
}