/**
 * Floating Robot Widget Styles
 * Beautiful, modern floating robot that roams the admin area
 * Dark theme compatible with Cursor-style chat
 * Version: 1.0.1 - Enhanced CSS persistence
 */

/* Floating Bot Specific CSS Variables - Isolated from page styles */
:root {
    /* Floating Bot Color Scheme - Independent */
    --fb-bg-primary: #1e1e1e;
    --fb-bg-secondary: #252525;
    --fb-bg-tertiary: #2d2d2d;
    --fb-bg-input: #3c3c3c;
    --fb-text-primary: #ffffff;
    --fb-text-secondary: #cccccc;
    --fb-text-muted: #999999;
    --fb-border-color: #404040;
    --fb-border-hover: #555555;
    --fb-accent-primary: #007acc;
    --fb-accent-secondary: #4fc3f7;
    --fb-success: #4caf50;
    --fb-warning: #ff9800;
    --fb-error: #f44336;
    --fb-info: #2196f3;
    
    /* Floating Bot Specific Colors */
    --fb-robot-primary: #00d4aa;
    --fb-robot-secondary: #00a085;
    --fb-chat-bg: #1a1a1a;
    --fb-chat-bubble-user: #007acc;
    --fb-chat-bubble-bot: #2d2d2d;
    --fb-shadow: rgba(0, 0, 0, 0.3);
    --fb-shadow-hover: rgba(0, 0, 0, 0.5);
}

/* Floating Bot Container - Apply variables to all floating bot elements */
.floating-robot-container,
#floating-robot,
.floating-robot-modal,
.floating-robot-chat,
.floating-robot-widget {
    /* Inherit all floating bot variables */
    --fb-bg-primary: var(--fb-bg-primary);
    --fb-bg-secondary: var(--fb-bg-secondary);
    --fb-bg-tertiary: var(--fb-bg-tertiary);
    --fb-bg-input: var(--fb-bg-input);
    --fb-text-primary: var(--fb-text-primary);
    --fb-text-secondary: var(--fb-text-secondary);
    --fb-text-muted: var(--fb-text-muted);
    --fb-border-color: var(--fb-border-color);
    --fb-border-hover: var(--fb-border-hover);
    --fb-accent-primary: var(--fb-accent-primary);
    --fb-accent-secondary: var(--fb-accent-secondary);
    --fb-success: var(--fb-success);
    --fb-warning: var(--fb-warning);
    --fb-error: var(--fb-error);
    --fb-info: var(--fb-info);
    --fb-robot-primary: var(--fb-robot-primary);
    --fb-robot-secondary: var(--fb-robot-secondary);
    --fb-chat-bg: var(--fb-chat-bg);
    --fb-chat-bubble-user: var(--fb-chat-bubble-user);
    --fb-chat-bubble-bot: var(--fb-chat-bubble-bot);
    --fb-shadow: var(--fb-shadow);
    --fb-shadow-hover: var(--fb-shadow-hover);
}

/* Dark Theme Variables - Unified with Bot Assistant (Legacy) */
:root {
    --bg-primary: #1e1e1e;
    --bg-secondary: #252525;
    --bg-tertiary: #2d2d2d;
    --bg-input: #3c3c3c;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #999999;
    --border-color: #404040;
    --border-hover: #555555;
    --accent-primary: #007acc;
    --accent-secondary: #4fc3f7;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.5);
    --shadow-heavy: rgba(0, 0, 0, 0.7);
    
    /* Bot Assistant Colors - Unified */
    --bot-primary: #667eea;
    --bot-secondary: #764ba2;
    --bot-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bot-success: #10b981;
    --bot-warning: #f59e0b;
    --bot-error: #ef4444;
    --bot-info: #3b82f6;
}

/* Robot Container - Enhanced specificity */
body #ai-floating-robot,
html body #ai-floating-robot,
.wp-admin #ai-floating-robot {
    position: fixed !important;
    width: 100px !important;
    height: 100px !important;
    z-index: 999998 !important;
    cursor: pointer !important;
    user-select: none !important;
    transition: transform 0.3s ease !important;
    pointer-events: all !important;
    display: block !important;
    visibility: visible !important;
}

/* Enhanced hover effect */
body #ai-floating-robot:hover:not(.minimized),
html body #ai-floating-robot:hover:not(.minimized),
.wp-admin #ai-floating-robot:hover:not(.minimized) {
    transform: scale(1.1) !important;
}

/* Hide button - appears on hover */
.robot-hide-btn {
    position: absolute !important;
    top: -10px !important;
    right: -10px !important;
    width: 32px !important;
    height: 32px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: 2px solid #667eea !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: all 0.3s ease !important;
    z-index: 999999 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    padding: 0 !important;
}

.robot-hide-btn:hover {
    background: #667eea !important;
    color: white !important;
    transform: scale(1.1) !important;
}

.robot-hide-btn .dashicons {
    width: 18px !important;
    height: 18px !important;
    font-size: 18px !important;
    line-height: 1 !important;
    color: #667eea !important;
    transition: color 0.3s ease !important;
}

.robot-hide-btn:hover .dashicons {
    color: white !important;
}

/* Show hide button on hover (only when not minimized) */
body #ai-floating-robot:hover:not(.minimized) .robot-hide-btn,
html body #ai-floating-robot:hover:not(.minimized) .robot-hide-btn,
.wp-admin #ai-floating-robot:hover:not(.minimized) .robot-hide-btn {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Minimized state */
#ai-floating-robot.minimized {
    width: 50px !important;
    height: 50px !important;
    transition: all 0.5s ease !important;
    cursor: pointer !important;
    top: 20px !important;
    right: 20px !important;
    left: auto !important;
}

#ai-floating-robot.minimized .robot-container {
    animation: none !important;
}

#ai-floating-robot.minimized .robot-glow {
    display: none !important;
}

#ai-floating-robot.minimized .robot-tooltip {
    display: none !important;
}

#ai-floating-robot.minimized .robot-hide-btn {
    display: none !important;
}

#ai-floating-robot.minimized:hover {
    transform: scale(1.15) !important;
}

/* Ripple Effect Container - Only visible when minimized */
.robot-ripple-container {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 50px !important;
    height: 50px !important;
    pointer-events: none !important;
    z-index: 1 !important;
}

/* Inner Pulse Glow - Center pulse effect */
.robot-ripple-pulse {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 50px !important;
    height: 50px !important;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.8) 0%, rgba(118, 75, 162, 0.4) 50%, transparent 100%) !important;
    border-radius: 50% !important;
    animation: pulse-glow-center 2s ease-in-out infinite !important;
    pointer-events: none !important;
    z-index: 2 !important;
}

@keyframes pulse-glow-center {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.4;
    }
}

/* Ripple Wave Animation - Enhanced with gradient and glow */
.robot-ripple-wave {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scale(1) !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    pointer-events: none !important;
    z-index: 1 !important;
}

/* Multiple ripple layers with different styles */
.robot-ripple-wave::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: 3px solid transparent !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.9) 0%, 
        rgba(118, 75, 162, 0.7) 50%, 
        rgba(102, 126, 234, 0.5) 100%) !important;
    -webkit-mask: radial-gradient(circle, transparent 48%, black 49%, black 51%, transparent 52%) !important;
    mask: radial-gradient(circle, transparent 48%, black 49%, black 51%, transparent 52%) !important;
    animation: ripple-expand-primary 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite !important;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6),
                0 0 40px rgba(118, 75, 162, 0.4),
                inset 0 0 20px rgba(102, 126, 234, 0.3) !important;
}

.robot-ripple-wave::after {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: 2px solid rgba(102, 126, 234, 0.4) !important;
    border-radius: 50% !important;
    animation: ripple-expand-secondary 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite !important;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.5) !important;
}

@keyframes ripple-expand-primary {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: blur(0px);
    }
    30% {
        opacity: 0.9;
        filter: blur(1px);
    }
    70% {
        opacity: 0.5;
        filter: blur(2px);
    }
    100% {
        transform: scale(4.5);
        opacity: 0;
        filter: blur(4px);
    }
}

@keyframes ripple-expand-secondary {
    0% {
        transform: scale(1);
        opacity: 0.8;
        filter: blur(0px);
    }
    50% {
        opacity: 0.4;
        filter: blur(1px);
    }
    100% {
        transform: scale(5);
        opacity: 0;
        filter: blur(3px);
    }
}

/* Staggered animation delays for multiple waves */
/* Note: pulse glow is first child, so waves start from nth-child(2) */
.robot-ripple-wave:nth-of-type(1)::before,
.robot-ripple-wave:nth-of-type(1)::after {
    animation-delay: 0s !important;
}

.robot-ripple-wave:nth-of-type(2)::before,
.robot-ripple-wave:nth-of-type(2)::after {
    animation-delay: 0.8s !important;
}

.robot-ripple-wave:nth-of-type(3)::before,
.robot-ripple-wave:nth-of-type(3)::after {
    animation-delay: 1.6s !important;
}

/* Robot Icon - Enhanced specificity */
body #ai-floating-robot .robot-container,
html body #ai-floating-robot .robot-container,
.wp-admin #ai-floating-robot .robot-container {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    animation: float 3s ease-in-out infinite !important;
}

body #ai-floating-robot .robot-icon,
html body #ai-floating-robot .robot-icon,
.wp-admin #ai-floating-robot .robot-icon {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15)) !important;
}

/* Floating Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Glow Effect - Using unified colors */
.robot-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse-glow 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* Pulse Effect when Analyzing */
.robot-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #667eea;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

#ai-floating-robot.analyzing .robot-pulse {
    animation: analyzing-pulse 1.5s ease-out infinite;
}

@keyframes analyzing-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Tooltip - Using unified bot colors */
.robot-tooltip {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bot-gradient);
    color: var(--fb-text-primary, #ffffff);
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 8px 24px var(--shadow-medium);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
    font-size: 13px;
    min-width: 200px;
}

.robot-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--bot-secondary);
}

.robot-tooltip.visible {
    opacity: 1;
    visibility: visible;
    bottom: 90px;
}

.robot-tooltip-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.robot-name {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
}

.robot-status {
    font-size: 12px;
    opacity: 0.95;
    font-weight: 400;
}

/* Chat Modal - Using unified theme with enhanced positioning */
.robot-chat-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--shadow-heavy);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 20px;
    box-sizing: border-box;
}

.robot-chat-modal.active {
    opacity: 1;
    visibility: visible;
}

/* Prevent body scroll when modal is open */
body.robot-modal-open {
    overflow: hidden;
}

/* Modal Content - Using unified theme */
.robot-chat-modal-content {
    background: var(--fb-bg-primary, #1e1e1e);
    border-radius: 16px;
    width: 90%;
    max-width: 1200px;
    height: 85%;
    max-height: 800px;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px var(--shadow-heavy);
    animation: modalSlideIn 0.3s ease;
    border: 1px solid var(--fb-border-color, #404040);
    position: relative;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header - Using unified theme */
.robot-chat-modal-header {
    padding: 24px 30px;
    background: var(--bot-gradient);
    color: var(--fb-text-primary, #ffffff);
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.modal-header-content h2 {
    margin: 0 0 5px 0;
    font-size: 22px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.robot-icon-small {
    font-size: 24px;
}

.modal-description {
    margin: 0;
    opacity: 0.9;
    font-size: 14px;
}

/* Close Button */
.robot-chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.robot-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.robot-chat-close .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

/* Modal Body - Using unified theme */
.robot-chat-modal-body {
    flex: 1;
    overflow: hidden;
    border-radius: 0 0 16px 16px;
    background: var(--fb-bg-primary, #1e1e1e);
    display: flex;
    flex-direction: column;
}

/* Loading State */
.robot-chat-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--accent-primary, #007acc);
    font-size: 14px;
    gap: 15px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color, #404040);
    border-top-color: var(--accent-primary, #007acc);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Chat Content */
.robot-chat-content {
    height: 100%;
    overflow: hidden;
}

/* Ensure cursor chat container displays properly inside modal */
.robot-chat-content .cursor-chat-container {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Ensure input container is visible */
.robot-chat-content .cursor-chat-input-container {
    display: flex !important;
    flex-shrink: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Ensure input and button are visible */
.robot-chat-content .cursor-chat-input,
.robot-chat-content .send-button {
    display: block !important;
    visibility: visible !important;
}

.robot-chat-content .chat-input-wrapper {
    display: flex !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.robot-chat-content .cursor-chat-input {
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Standalone Chat Section - Using unified theme */
.bot-chat-section-standalone {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--fb-bg-primary, #1e1e1e);
}

.bot-chat-section-standalone .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--fb-bg-primary, #1e1e1e);
    color: var(--fb-text-primary, #ffffff);
}

.bot-chat-section-standalone .chat-input-container {
    padding: 20px;
    border-top: 1px solid var(--fb-border-color, #404040);
    background: var(--fb-bg-secondary, #252525);
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.bot-chat-section-standalone .chat-header {
    padding: 20px;
    background: var(--bot-gradient);
    color: var(--fb-text-primary, #ffffff);
    border-bottom: 1px solid var(--fb-border-color, #404040);
    flex-shrink: 0;
}

/* Action Message Styles */
.robot-chat-content .action-message {
    padding: 15px;
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    margin-top: 10px;
}

.robot-chat-content .action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.robot-chat-content .action-buttons .button {
    flex: 1;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.robot-chat-content .action-confirm {
    background: #10b981 !important;
    color: white !important;
}

.robot-chat-content .action-confirm:hover {
    background: #059669 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.robot-chat-content .action-cancel {
    background: #6b7280 !important;
    color: white !important;
}

.robot-chat-content .action-cancel:hover {
    background: #4b5563 !important;
}

.robot-chat-content .action-progress {
    margin-top: 15px;
}

.robot-chat-content .progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.robot-chat-content .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 200% 100%;
    animation: progressAnimation 1.5s ease-in-out infinite;
}

.robot-chat-content .progress-text {
    text-align: center;
    color: #667eea;
    font-weight: 600;
    margin-top: 10px;
    font-size: 14px;
}

.robot-chat-content .action-result {
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
    font-weight: 600;
}

.robot-chat-content .action-result.success {
    background: #ecfdf5;
    border: 1px solid #10b981;
}

.robot-chat-content .action-result.error {
    background: #fef2f2;
    border: 1px solid #ef4444;
}

/* Execute Plan Button */
.robot-chat-content .execute-plan-container {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    text-align: center;
    color: white;
}

.robot-chat-content .execute-plan-btn {
    padding: 15px 30px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.robot-chat-content .execute-plan-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.robot-chat-content .execute-plan-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.robot-chat-content .plan-info {
    display: block;
    margin-top: 10px;
    font-size: 14px;
    opacity: 0.9;
}

/* Robot States */
#ai-floating-robot[data-state="idle"] .robot-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

#ai-floating-robot[data-state="moving"] {
    animation: robot-move 0.5s ease-in-out infinite;
}

@keyframes robot-move {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-3px);
    }
}

#ai-floating-robot[data-state="analyzing"] {
    animation: robot-analyze 1s ease-in-out infinite;
}

@keyframes robot-analyze {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Responsive */
@media (max-width: 782px) {
    .robot-chat-modal-content {
        width: 95%;
        height: 90%;
        max-height: none;
        min-height: 500px;
        border-radius: 12px;
    }
    
    .robot-chat-modal-header {
        padding: 20px;
        border-radius: 12px 12px 0 0;
    }
    
    .modal-header-content h2 {
        font-size: 18px;
    }
    
    .robot-chat-modal-body {
        border-radius: 0 0 12px 12px;
    }
    
    .bot-chat-section-standalone .chat-messages {
        padding: 15px;
    }
    
    .bot-chat-section-standalone .chat-input-container {
        padding: 15px;
    }
    
    .robot-tooltip {
        min-width: 150px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .robot-chat-modal-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
        min-height: 100vh;
    }
    
    .robot-chat-modal-header {
        border-radius: 0;
        padding: 15px;
    }
    
    .robot-chat-modal-body {
        border-radius: 0;
    }
}

/* Animations */
@keyframes robotAppear {
    from {
        opacity: 0;
        transform: scale(0) rotate(180deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

#ai-floating-robot {
    animation: robotAppear 0.5s ease-out;
}

/* Hover Effects */
#ai-floating-robot:hover .robot-glow {
    animation-duration: 1s;
    opacity: 1;
}

/* Chat Input - Cursor Style */
.bot-chat-section-standalone .chat-input-container {
    background: var(--fb-bg-secondary, #252525);
    border-top: 1px solid var(--fb-border-color, #404040);
    padding: 16px 20px;
    flex-shrink: 0;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--fb-bg-input, #3c3c3c);
    border: 1px solid var(--fb-border-color, #404040);
    border-radius: 24px;
    padding: 8px 16px;
    transition: all 0.2s ease;
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2);
}

.bot-chat-section-standalone .chat-input-container input[type="text"] {
    flex: 1;
    background: none;
    border: none;
    color: var(--fb-text-primary, #ffffff);
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    padding: 8px 0;
}

.bot-chat-section-standalone .chat-input-container input[type="text"]::placeholder {
    color: var(--fb-text-muted, #999999);
}

.bot-chat-section-standalone .chat-input-container button {
    background: var(--fb-accent-primary);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 16px;
}

.bot-chat-section-standalone .chat-input-container button:hover {
    background: var(--accent-secondary);
    transform: scale(1.05);
}

.bot-chat-section-standalone .chat-input-container button:disabled {
    background: var(--fb-bg-tertiary, #2d2d2d);
    color: var(--fb-text-muted, #999999);
    cursor: not-allowed;
    transform: none;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--fb-bg-secondary, #252525);
    border-radius: 18px 18px 18px 4px;
    max-width: 85%;
    margin-bottom: 24px;
}

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

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingDot 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 typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Message Status */
.message-status {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--fb-text-muted, #999999);
}

.message-status.success {
    color: var(--success-color);
}

.message-status.error {
    color: var(--error-color);
}

.message-status.warning {
    color: var(--warning-color);
}

/* Code Blocks */
.code-block {
    background: var(--fb-bg-tertiary, #2d2d2d);
    border: 1px solid var(--fb-border-color, #404040);
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
    color: var(--fb-text-primary, #ffffff);
}

.code-block code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-family: inherit;
}

/* Inline Code */
.inline-code {
    background: var(--fb-bg-tertiary, #2d2d2d);
    color: var(--fb-text-primary, #ffffff);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 13px;
}

/* Links */
.bot-message-content a {
    color: var(--fb-accent-primary, #007acc);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.bot-message-content a:hover {
    border-bottom-color: var(--accent-primary);
}

/* Lists */
.bot-message-content ul,
.bot-message-content ol {
    margin: 12px 0;
    padding-left: 20px;
}

.bot-message-content li {
    margin: 4px 0;
    line-height: 1.5;
}

/* Blockquotes */
.bot-message-content blockquote {
    border-left: 4px solid var(--accent-primary);
    padding-left: 16px;
    margin: 12px 0;
    color: var(--fb-text-secondary, #cccccc);
    font-style: italic;
}

/* Tables */
.bot-message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.bot-message-content th,
.bot-message-content td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--fb-border-color, #404040);
}

.bot-message-content th {
    background: var(--fb-bg-tertiary, #2d2d2d);
    font-weight: 600;
    color: var(--fb-text-primary, #ffffff);
}

/* Cursor-Style Chat Messages */
.bot-chat-section-standalone .chat-messages {
    scroll-behavior: smooth;
}

.bot-chat-section-standalone .chat-messages::-webkit-scrollbar {
    width: 6px;
}

.bot-chat-section-standalone .chat-messages::-webkit-scrollbar-track {
    background: var(--fb-bg-secondary, #252525);
}

.bot-chat-section-standalone .chat-messages::-webkit-scrollbar-thumb {
    background: var(--fb-border-color, #404040);
    border-radius: 3px;
}

.bot-chat-section-standalone .chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Message Styles */
.cursor-message {
    margin-bottom: 24px;
    animation: messageSlideIn 0.3s ease-out;
}

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

.cursor-message.user {
    display: flex;
    justify-content: flex-end;
}

.cursor-message.bot {
    display: flex;
    justify-content: flex-start;
}

/* User Message */
.user-message-content {
    background: var(--fb-accent-primary);
    color: white;
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
    max-width: 70%;
    word-wrap: break-word;
    box-shadow: 0 2px 8px var(--shadow-light);
}

/* Bot Message */
.bot-message-content {
    background: var(--fb-bg-secondary, #252525);
    color: var(--fb-text-primary, #ffffff);
    padding: 16px 20px;
    border-radius: 18px 18px 18px 4px;
    max-width: 85%;
    word-wrap: break-word;
    border: 1px solid var(--fb-border-color, #404040);
    box-shadow: 0 2px 8px var(--shadow-light);
    position: relative;
}

.bot-message-content::before {
    content: '';
    position: absolute;
    top: 12px;
    left: -8px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid var(--bg-secondary);
}

/* Bot Avatar */
.bot-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
    animation: botBounce 2s ease-in-out infinite;
}

@keyframes botBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

/* Step Display Container */
.cursor-step-container {
    background: var(--fb-bg-tertiary, #2d2d2d);
    border: 1px solid var(--fb-border-color, #404040);
    border-radius: 12px;
    margin: 16px 0;
    overflow: hidden;
    box-shadow: 0 4px 16px var(--shadow-medium);
}

.step-header {
    background: var(--fb-bg-secondary, #252525);
    padding: 16px 20px;
    border-bottom: 1px solid var(--fb-border-color, #404040);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.step-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--fb-text-primary, #ffffff);
    font-size: 16px;
    font-weight: 600;
}

.step-counter {
    color: var(--fb-text-muted, #999999);
    font-size: 14px;
    background: var(--fb-bg-input, #3c3c3c);
    padding: 4px 8px;
    border-radius: 12px;
}

.step-toggle {
    background: none;
    border: none;
    color: var(--fb-text-secondary, #cccccc);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.step-toggle:hover {
    background: var(--fb-bg-input, #3c3c3c);
    color: var(--fb-text-primary, #ffffff);
}

.step-toggle.expanded {
    transform: rotate(180deg);
}

/* Step Items */
.step-items {
    padding: 16px 20px;
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--fb-border-color, #404040);
    transition: all 0.2s ease;
}

.step-item:last-child {
    border-bottom: none;
}

.step-item:hover {
    background: var(--fb-bg-secondary, #252525);
    margin: 0 -20px;
    padding: 12px 20px;
    border-radius: 8px;
}

.step-item.completed {
    opacity: 0.8;
}

.step-item.current {
    background: rgba(0, 122, 204, 0.1);
    border-left: 3px solid var(--accent-primary);
    margin: 0 -20px;
    padding: 12px 20px;
}

.step-item.failed {
    background: rgba(244, 67, 54, 0.1);
    border-left: 3px solid var(--error-color);
    margin: 0 -20px;
    padding: 12px 20px;
}

.step-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.step-icon.pending {
    background: var(--fb-bg-input, #3c3c3c);
    color: var(--fb-text-muted, #999999);
}

.step-icon.current {
    background: var(--fb-accent-primary);
    color: white;
    animation: stepPulse 1.5s ease-in-out infinite;
}

.step-icon.completed {
    background: var(--success-color);
    color: white;
}

.step-icon.failed {
    background: var(--error-color);
    color: white;
}

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

.step-content {
    flex: 1;
    color: var(--fb-text-primary, #ffffff);
}

.step-title-text {
    font-weight: 600;
    margin-bottom: 4px;
}

.step-description {
    color: var(--fb-text-secondary, #cccccc);
    font-size: 14px;
    line-height: 1.4;
}

/* Progress Bar */
.step-progress {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--fb-border-color, #404040);
}

.progress-bar-container {
    background: var(--fb-bg-input, #3c3c3c);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--fb-text-muted, #999999);
}

/* Message Styling */
.bot-chat-section-standalone .chat-messages .bot-message,
.bot-chat-section-standalone .chat-messages .user-message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
}

.bot-chat-section-standalone .chat-messages .bot-message {
    background: var(--fb-bg-secondary, #252525);
    color: var(--fb-text-primary, #ffffff);
    margin-right: auto;
}

.bot-chat-section-standalone .chat-messages .user-message {
    background: var(--fb-accent-primary);
    color: var(--fb-text-primary, #ffffff);
    margin-left: auto;
}

#ai-floating-robot:hover .robot-tooltip {
    opacity: 1;
    visibility: visible;
    bottom: 90px;
}

/* Loading State */
#ai-floating-robot.loading .robot-icon {
    filter: brightness(0.8);
    animation: none;
}

/* Hide on certain pages if needed */
body.toplevel_page_aiautotool-bot-assistant #ai-floating-robot {
    display: none;
}

