/**
 * Live Updates CSS
 * Animations and styling for real-time table updates
 */

/* =============================================================================
   Live Update Row Animation
   ============================================================================= */

.live-update-row {
    opacity: 0;
    transform: translateY(-20px);
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease-out;
}

.live-update-row.live-update-visible {
    opacity: 1;
    transform: translateY(0);
    max-height: 200px;
}

/* Gold highlight pulse on new rows */
.live-update-row.live-update-visible {
    animation: liveUpdatePulse 2s ease-out;
}

@keyframes liveUpdatePulse {
    0% { 
        box-shadow: inset 4px 0 0 rgba(241, 196, 15, 1),
                    inset 0 0 30px rgba(241, 196, 15, 0.4);
    }
    50% {
        box-shadow: inset 4px 0 0 rgba(241, 196, 15, 0.8),
                    inset 0 0 15px rgba(241, 196, 15, 0.2);
    }
    100% { 
        box-shadow: inset 4px 0 0 rgba(241, 196, 15, 0),
                    inset 0 0 0 rgba(241, 196, 15, 0);
    }
}


/* =============================================================================
   Live Status Indicator
   ============================================================================= */

.live-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.live-status-indicator .pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted-text);
    transition: background 0.3s ease;
}

/* Connected state - green pulsing dot */
.live-status-indicator.connected {
    border-color: rgba(40, 167, 69, 0.4);
    background: rgba(40, 167, 69, 0.1);
}

.live-status-indicator.connected .pulse-dot {
    background: #28a745;
    animation: livePulse 2s infinite;
}

.live-status-indicator.connected .status-text {
    color: #28a745;
}

/* Disconnected state */
.live-status-indicator.disconnected {
    border-color: var(--border-color);
    background: var(--tertiary-bg);
}

.live-status-indicator.disconnected .pulse-dot {
    background: var(--muted-text);
    animation: none;
}

/* Connecting state */
.live-status-indicator.connecting .pulse-dot {
    background: var(--accent-color);
    animation: livePulse 0.5s infinite;
}

@keyframes livePulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1); 
    }
    50% { 
        opacity: 0.5; 
        transform: scale(1.3); 
    }
}


/* =============================================================================
   Login Prompt for Non-Authenticated Users
   ============================================================================= */

.live-login-prompt {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(241, 196, 15, 0.1);
    border: 1px solid rgba(241, 196, 15, 0.3);
    border-radius: 20px;
    font-size: 12px;
    color: var(--accent-color);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.live-login-prompt:hover {
    background: rgba(241, 196, 15, 0.15);
    border-color: rgba(241, 196, 15, 0.5);
    text-decoration: none;
}

.live-login-prompt .offline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted-text);
}

/* Tooltip for live login prompt */
.live-tooltip-text {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: #1a1a2e;
    border: 1px solid rgba(241, 196, 15, 0.4);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    font-size: 11px;
    font-weight: 400;
    color: #b0b0b0;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 9999;
    pointer-events: none;
}

.live-login-prompt:hover .live-tooltip-text {
    opacity: 1;
    visibility: visible;
}


/* =============================================================================
   Toast Notification for New Items
   ============================================================================= */

.live-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: var(--secondary-bg);
    border: 1px solid rgba(241, 196, 15, 0.4);
    border-left: 4px solid var(--accent-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s ease;
}

.live-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.live-toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.live-toast-icon {
    font-size: 20px;
}

.live-toast-text {
    color: var(--primary-text);
    font-size: 14px;
}

.live-toast-company {
    color: var(--accent-color);
    font-weight: 600;
}


/* =============================================================================
   Mobile Responsive
   ============================================================================= */

@media (max-width: 768px) {
    .live-status-indicator {
        padding: 4px 10px;
        font-size: 11px;
    }
    
    .live-status-indicator .status-text {
        display: none;
    }
    
    .live-login-prompt {
        padding: 4px 10px;
        font-size: 11px;
    }
    
    .live-login-prompt span:first-child {
        /* Hide "🔴" on mobile to save space */
    }
    
    .live-toast {
        bottom: 10px;
        right: 10px;
        left: 10px;
        padding: 10px 16px;
    }
}
