/**
 * Floating Agent Chat Widget Styles
 * A floating chat button with popup chat interface
 */

/* Floating Button */
.agent-chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.agent-chat-fab-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4),
                0 8px 32px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.agent-chat-fab-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.agent-chat-fab-button:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 6px 28px rgba(99, 102, 241, 0.5),
                0 12px 40px rgba(0, 0, 0, 0.2);
}

.agent-chat-fab-button:hover::before {
    opacity: 1;
}

.agent-chat-fab-button:active {
    transform: scale(1.05);
}

.agent-chat-fab-button.open {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4),
                0 8px 32px rgba(0, 0, 0, 0.15);
}

.agent-chat-fab-button.open:hover {
    box-shadow: 0 6px 28px rgba(239, 68, 68, 0.5),
                0 12px 40px rgba(0, 0, 0, 0.2);
}

.agent-chat-fab-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.agent-chat-fab-button.open .agent-chat-fab-icon {
    transform: rotate(90deg);
}

/* Notification Badge */
.agent-chat-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 600;
    color: white;
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Tooltip */
.agent-chat-fab-tooltip {
    position: absolute;
    right: 72px;
    background: #1e293b;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(10px);
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.agent-chat-fab-tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 6px solid #1e293b;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

.agent-chat-fab-button:hover + .agent-chat-fab-tooltip,
.agent-chat-fab-tooltip:hover {
    opacity: 1;
    transform: translateX(0);
}

.agent-chat-fab-button.open + .agent-chat-fab-tooltip {
    display: none;
}

/* Chat Popup Container */
.agent-chat-popup {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 400px;
    height: 600px;
    max-height: calc(100vh - 140px);
    z-index: 9998;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2),
                0 2px 10px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.agent-chat-popup.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Embedded widget overrides for popup */
.agent-chat-popup .agent-chat-widget {
    height: 100%;
    border-radius: 16px;
}

/* Context Banner */
.agent-chat-context-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    font-size: 0.75rem;
    color: #6366f1;
}

.agent-chat-context-banner i {
    font-size: 0.875rem;
}

.agent-chat-context-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 100px;
}

.agent-chat-context-item strong {
    font-weight: 500;
}

.agent-chat-context-page {
    margin-left: auto;
    color: #64748b;
}

/* Responsive */
@media (max-width: 480px) {
    .agent-chat-fab {
        bottom: 16px;
        right: 16px;
    }

    .agent-chat-fab-button {
        width: 56px;
        height: 56px;
        font-size: 1.25rem;
    }

    .agent-chat-popup {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        transform: translateY(100%);
    }

    .agent-chat-popup.open {
        transform: translateY(0);
    }

    .agent-chat-popup .agent-chat-widget {
        border-radius: 0;
    }

    .agent-chat-fab-tooltip {
        display: none;
    }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .agent-chat-fab-tooltip {
        background: #0f172a;
    }

    .agent-chat-fab-tooltip::after {
        border-left-color: #0f172a;
    }
}

/* Minimize Animation */
.agent-chat-popup.minimizing {
    animation: minimizeChat 0.3s ease-out forwards;
}

@keyframes minimizeChat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
}

/* Welcome Animation */
.agent-chat-fab.welcome .agent-chat-fab-button {
    animation: welcomeBounce 0.6s ease-out;
}

@keyframes welcomeBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* Pulse ring effect on first load */
.agent-chat-fab-button.pulse-ring::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid rgba(99, 102, 241, 0.5);
    border-radius: 50%;
    animation: pulseRing 2s ease-out infinite;
}

@keyframes pulseRing {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

