/* Real-Time Collaboration Styles for Kanban Board */

/* Integrated Active Users Display - Clean Avatar-Only Design */
.active-users-integrated {
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background: rgba(var(--bs-primary-rgb), 0.03);
    border: 1px solid rgba(var(--bs-primary-rgb), 0.1);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.active-users-integrated:hover {
    background: rgba(var(--bs-primary-rgb), 0.05);
    border-color: rgba(var(--bs-primary-rgb), 0.15);
}

.active-users-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
}

.active-users-list {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

/* Integrated User Avatars - Clean Profile Photos Only */
.user-avatar-integrated {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.9);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.user-avatar-integrated:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 10;
}

/* Subtle current user indication - just a slightly different border */
.user-avatar-integrated.current-user-indicator {
    border-color: #28a745;
    border-width: 2.5px;
}

.user-avatar-integrated.current-user-indicator:hover {
    border-color: #28a745;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.user-avatar-photo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.user-avatar-initials {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Legacy User Presence Indicators (for backwards compatibility) */
.user-presence-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 8px 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.user-presence-container:hover {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.user-presence-header {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 4px;
    font-weight: 600;
}

.user-presence-list {
    display: flex;
    gap: 6px;
    align-items: center;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.user-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.user-avatar.current-user {
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.3);
}

.user-avatar::after {
    content: attr(data-email);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1060;
}

.user-avatar:hover::after {
    opacity: 1;
}

/* Card Lock Indicators */
.card-lock-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #dc3545;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 10;
    animation: pulse 2s infinite;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.card-lock-indicator::before {
    content: "🔒 ";
    margin-right: 2px;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Real-Time Update Notifications */
.realtime-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1055;
    background: #17a2b8;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
    font-size: 0.9rem;
}

.realtime-notification.show {
    transform: translateX(0);
}

.realtime-notification::before {
    content: "🔄 ";
    margin-right: 6px;
}

/* Conflict Resolution Notification */
.conflict-notification {
    position: fixed;
    top: 120px;
    right: 20px;
    z-index: 1055;
    background: #ffc107;
    color: #212529;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
    font-size: 0.9rem;
    font-weight: 600;
}

.conflict-notification.show {
    transform: translateX(0);
}

.conflict-notification::before {
    content: "⚠️ ";
    margin-right: 6px;
}

/* Collaborative Update Highlights */
.card-updated-by-collaborator {
    border-left: 4px solid #17a2b8 !important;
    background: linear-gradient(90deg, rgba(23, 162, 184, 0.1) 0%, transparent 100%) !important;
    animation: collaborativeUpdate 3s ease-out;
}

@keyframes collaborativeUpdate {
    0% {
        background: linear-gradient(90deg, rgba(23, 162, 184, 0.3) 0%, transparent 100%);
        transform: scale(1.02);
    }
    100% {
        background: linear-gradient(90deg, rgba(23, 162, 184, 0.1) 0%, transparent 100%);
        transform: scale(1);
    }
}

/* User Color Assignments */
.user-color-1 { background-color: #007bff; }
.user-color-2 { background-color: #28a745; }
.user-color-3 { background-color: #dc3545; }
.user-color-4 { background-color: #ffc107; color: #212529; }
.user-color-5 { background-color: #17a2b8; }
.user-color-6 { background-color: #6f42c1; }
.user-color-7 { background-color: #fd7e14; }
.user-color-8 { background-color: #e83e8c; }
.user-color-9 { background-color: #20c997; }
.user-color-10 { background-color: #6c757d; }

/* Dark Mode Support */
html[data-bs-theme="dark"] .user-presence-container {
    background: rgba(33, 37, 41, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

html[data-bs-theme="dark"] .user-presence-container:hover {
    background: rgba(33, 37, 41, 0.98);
}

html[data-bs-theme="dark"] .user-presence-header {
    color: #adb5bd;
}

html[data-bs-theme="dark"] .realtime-notification {
    background: #0d6efd;
}

html[data-bs-theme="dark"] .conflict-notification {
    background: #fd7e14;
    color: #fff;
}

html[data-bs-theme="dark"] .card-updated-by-collaborator {
    border-left-color: #0d6efd !important;
    background: linear-gradient(90deg, rgba(13, 110, 253, 0.1) 0%, transparent 100%) !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    /* Integrated Active Users - Mobile - Even More Compact */
    .active-users-integrated {
        padding: 0.4rem 0.6rem;
        margin-bottom: 0.75rem;
    }
    
    .active-users-header {
        justify-content: flex-start;
    }
    
    .user-avatar-integrated {
        width: 34px;
        height: 34px;
        font-size: 0.75rem;
    }
    
    .active-users-list {
        gap: 0.3rem;
        flex-wrap: wrap;
    }
    
    /* Legacy styles */
    .user-presence-container {
        position: fixed;
        top: 10px;
        right: 10px;
        padding: 6px 10px;
    }
    
    .user-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
    
    .realtime-notification,
    .conflict-notification {
        right: 10px;
        max-width: calc(100vw - 20px);
        font-size: 0.8rem;
        padding: 10px 12px;
    }
    
    .card-lock-indicator {
        font-size: 0.6rem;
        padding: 3px 6px;
    }
}

/* Loading States */
.presence-loading {
    opacity: 0.6;
    animation: fadeInOut 1.5s infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Connection Status Indicator */
.connection-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

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

.connection-status.disconnected {
    background: #dc3545;
    color: white;
    animation: pulse 1s infinite;
}

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

/* Smooth Transitions */
.kanban-card {
    transition: all 0.2s ease;
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Real-time Card Update Indicators */
.kanban-card.realtime-updated {
    animation: realtimeUpdatePulse 1.5s ease-out;
    border-left: 3px solid #17a2b8;
}

.kanban-card.realtime-added {
    animation: realtimeAddSlide 1.5s ease-out;
    border-left: 3px solid #28a745;
}

.kanban-card.realtime-moved {
    animation: realtimeMoveSlide 1.5s ease-out;
    border-left: 3px solid #ffc107;
}

@keyframes realtimeUpdatePulse {
    0% {
        background-color: rgba(23, 162, 184, 0.2);
        transform: scale(1);
    }
    50% {
        background-color: rgba(23, 162, 184, 0.1);
        transform: scale(1.01);
    }
    100% {
        background-color: transparent;
        transform: scale(1);
    }
}

@keyframes realtimeAddSlide {
    0% {
        background-color: rgba(40, 167, 69, 0.3);
        transform: translateX(-10px);
        opacity: 0.8;
    }
    100% {
        background-color: transparent;
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes realtimeMoveSlide {
    0% {
        background-color: rgba(255, 193, 7, 0.2);
        transform: scale(1.02);
    }
    100% {
        background-color: transparent;
        transform: scale(1);
    }
}

/* Collaborative Update Notification */
.collaborative-update-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1055;
    background: #17a2b8;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideInRight 0.3s ease;
    transition: opacity 0.3s ease;
}

.collaborative-update-notification.fade-out {
    opacity: 0;
}

.collaborative-update-notification i {
    font-size: 0.9rem;
}

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

/* Focus States for Accessibility */
.user-avatar:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.card-lock-indicator:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}