/* WebSocket-related CSS styles for Chennai CRM */

/* Real-time notification styles */
.websocket-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Dashboard update animations */
.dashboard-element.updated {
    animation: pulse 1s ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
        background-color: rgba(0, 123, 255, 0.1);
    }
    100% {
        transform: scale(1);
    }
}

/* User presence indicators */
.user-presence {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.user-presence.bg-success {
    background-color: #28a745 !important;
    color: white;
}

.user-presence.bg-secondary {
    background-color: #6c757d !important;
    color: white;
}

/* WebSocket connection status */
.websocket-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 1000;
    transition: all 0.3s ease;
}

.websocket-status.connected {
    background-color: #28a745;
    color: white;
}

.websocket-status.disconnected {
    background-color: #dc3545;
    color: white;
}

.websocket-status.connecting {
    background-color: #ffc107;
    color: #212529;
}

/* Real-time update indicators */
.real-time-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: #6c757d;
}

.real-time-indicator::before {
    content: '';
    width: 6px;
    height: 6px;
    background-color: #28a745;
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0.3;
    }
}

/* Lead status update animations */
.lead-status.updated {
    animation: statusUpdate 0.5s ease-in-out;
}

@keyframes statusUpdate {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
    }
    100% {
        transform: scale(1);
    }
}

/* Call attempt logging styles */
.call-attempt-log {
    border-left: 3px solid #007bff;
    padding-left: 10px;
    margin: 5px 0;
    transition: all 0.2s ease;
}

.call-attempt-log:hover {
    background-color: rgba(0, 123, 255, 0.05);
    border-left-color: #0056b3;
}

/* Branch-specific notification styles */
.branch-notification {
    border-left: 3px solid #28a745;
    background-color: rgba(40, 167, 69, 0.05);
}

.branch-notification.chennai {
    border-left-color: #ff6b35;
    background-color: rgba(255, 107, 53, 0.05);
}

/* Mobile responsiveness for WebSocket elements */
@media (max-width: 768px) {
    .websocket-notification {
        left: 10px;
        right: 10px;
        min-width: auto;
        max-width: none;
    }
    
    .websocket-status {
        bottom: 10px;
        right: 10px;
        font-size: 0.7rem;
        padding: 6px 10px;
    }
    
    .user-presence {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .websocket-notification {
        background-color: #343a40;
        color: #f8f9fa;
        border: 1px solid #495057;
    }
    
    .websocket-status.connecting {
        background-color: #ffc107;
        color: #000;
    }
    
    .call-attempt-log:hover {
        background-color: rgba(0, 123, 255, 0.1);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .websocket-notification {
        border: 2px solid #000;
    }
    
    .user-presence {
        border: 1px solid #000;
    }
    
    .websocket-status {
        border: 1px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .websocket-notification,
    .dashboard-element.updated,
    .lead-status.updated {
        animation: none;
    }
    
    .real-time-indicator::before {
        animation: none;
    }
}
