/* Article Collaboration Styles
   Pure CSS implementation with no JavaScript required
   ================================================ */

/* CSS Variables for Theming */
:root {
    /* Author Colors Palette */
    --author-color-1: #FF6B6B;
    --author-color-2: #4ECDC4;
    --author-color-3: #45B7D1;
    --author-color-4: #FFA07A;
    --author-color-5: #98D8C8;
    --author-color-6: #F7DC6F;
    --author-color-7: #BB8FCE;
    --author-color-8: #85C1E2;
    --author-color-9: #F8C471;
    --author-color-10: #82E0AA;
    
    /* UI Colors */
    --collab-primary: #007bff;
    --collab-success: #28a745;
    --collab-warning: #ffc107;
    --collab-danger: #dc3545;
    --collab-info: #17a2b8;
    
    /* Spacing */
    --collab-spacing-sm: 0.5rem;
    --collab-spacing-md: 1rem;
    --collab-spacing-lg: 1.5rem;
    --collab-spacing-xl: 2rem;
    
    /* Animations */
    --collab-transition: all 0.3s ease;
    --collab-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --collab-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Author Color Assignment (CSS-only) */
.author-color-1 { --author-color: var(--author-color-1); }
.author-color-2 { --author-color: var(--author-color-2); }
.author-color-3 { --author-color: var(--author-color-3); }
.author-color-4 { --author-color: var(--author-color-4); }
.author-color-5 { --author-color: var(--author-color-5); }
.author-color-6 { --author-color: var(--author-color-6); }
.author-color-7 { --author-color: var(--author-color-7); }
.author-color-8 { --author-color: var(--author-color-8); }
.author-color-9 { --author-color: var(--author-color-9); }
.author-color-10 { --author-color: var(--author-color-10); }

/* Collaboration Badge Animation */
@keyframes collaboration-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.collaboration-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--collab-info);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    animation: collaboration-pulse 2s ease-in-out infinite;
}

/* Active Author Indicator */
.active-author-indicator {
    position: relative;
    display: inline-block;
}

.active-author-indicator::before {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: var(--collab-success);
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

/* Author Cards with Hover Effects */
.author-collaboration-card {
    background: white;
    border-radius: 12px;
    padding: var(--collab-spacing-lg);
    box-shadow: var(--collab-shadow);
    transition: var(--collab-transition);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.author-collaboration-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--author-color, var(--collab-primary));
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.author-collaboration-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--collab-shadow-hover);
    border-color: var(--author-color, var(--collab-primary));
}

.author-collaboration-card:hover::before {
    transform: translateX(0);
}

/* Author Avatar with Initial */
.author-avatar-initial {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--author-color, var(--collab-primary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.25rem;
    text-transform: uppercase;
    position: relative;
    transition: var(--collab-transition);
}

.author-avatar-initial:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(var(--author-color-rgb, 0, 123, 255), 0.2);
}

/* Collaboration Timeline */
.collaboration-timeline {
    position: relative;
    padding-left: 2.5rem;
}

.collaboration-timeline::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(
        to bottom,
        var(--collab-primary) 0%,
        rgba(0, 123, 255, 0.2) 100%
    );
}

.timeline-item {
    position: relative;
    padding-bottom: var(--collab-spacing-lg);
    opacity: 0;
    animation: timeline-fade-in 0.5s ease-out forwards;
}

.timeline-item:nth-child(1) { animation-delay: 0.1s; }
.timeline-item:nth-child(2) { animation-delay: 0.2s; }
.timeline-item:nth-child(3) { animation-delay: 0.3s; }
.timeline-item:nth-child(4) { animation-delay: 0.4s; }
.timeline-item:nth-child(5) { animation-delay: 0.5s; }

@keyframes timeline-fade-in {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.75rem;
    top: 0.5rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--author-color, var(--collab-primary));
    transition: var(--collab-transition);
}

.timeline-item:hover::before {
    transform: scale(1.3);
}

/* Invitation Cards */
.invitation-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    padding: var(--collab-spacing-xl);
    position: relative;
    overflow: hidden;
}

.invitation-card::after {
    content: '✉️';
    position: absolute;
    top: -20px;
    right: -20px;
    font-size: 100px;
    opacity: 0.1;
    transform: rotate(-15deg);
}

.invitation-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.invitation-status.pending {
    background: var(--collab-warning);
    color: #856404;
}

.invitation-status.accepted {
    background: var(--collab-success);
    color: white;
}

.invitation-status.declined {
    background: var(--collab-danger);
    color: white;
}

/* Conflict Resolution UI */
.conflict-resolution-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--collab-spacing-lg);
    margin-bottom: var(--collab-spacing-xl);
}

.conflict-version {
    background: white;
    border-radius: 12px;
    padding: var(--collab-spacing-lg);
    border: 2px solid #e9ecef;
    transition: var(--collab-transition);
    cursor: pointer;
    position: relative;
}

.conflict-version:hover {
    border-color: var(--collab-primary);
    transform: translateY(-2px);
}

.conflict-version.selected {
    border-color: var(--collab-primary);
    background: #e7f3ff;
}

.conflict-version.selected::after {
    content: '✓';
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 24px;
    height: 24px;
    background: var(--collab-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: check-mark 0.3s ease-out;
}

@keyframes check-mark {
    from {
        transform: scale(0) rotate(45deg);
    }
    to {
        transform: scale(1) rotate(0deg);
    }
}

/* Collaboration Stats */
.collab-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--collab-spacing-md);
    margin: var(--collab-spacing-lg) 0;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: var(--collab-spacing-lg);
    text-align: center;
    box-shadow: var(--collab-shadow);
    transition: var(--collab-transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--author-color, var(--collab-primary));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--collab-shadow-hover);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--author-color, var(--collab-primary));
    margin: 0;
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
}

/* Author Mention Styling */
.author-mention {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #e7f3ff;
    color: var(--collab-primary);
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
    transition: var(--collab-transition);
}

.author-mention:hover {
    background: var(--collab-primary);
    color: white;
    transform: translateY(-1px);
}

/* Collaboration Empty States */
.collab-empty-state {
    text-align: center;
    padding: var(--collab-spacing-xl) var(--collab-spacing-lg);
    color: #6c757d;
}

.collab-empty-icon {
    font-size: 4rem;
    margin-bottom: var(--collab-spacing-md);
    opacity: 0.3;
    animation: empty-state-float 3s ease-in-out infinite;
}

@keyframes empty-state-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .conflict-resolution-panel {
        grid-template-columns: 1fr;
    }
    
    .collab-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .collaboration-timeline {
        padding-left: 1.5rem;
    }
    
    .collaboration-timeline::before {
        left: 0.5rem;
    }
    
    .timeline-item::before {
        left: -1.25rem;
    }
}

/* Print Styles */
@media print {
    .collaboration-badge,
    .active-author-indicator::before,
    .author-collaboration-card:hover {
        animation: none !important;
    }
    
    .author-collaboration-card {
        page-break-inside: avoid;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .author-collaboration-card {
        border-width: 3px;
    }
    
    .conflict-version.selected {
        outline: 3px solid var(--collab-primary);
    }
}