/* 🤝 Real-Time Collaboration Interface - Premium Design */

.collaboration-container {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 9999;
    pointer-events: none;
}

.collaboration-container > * {
    pointer-events: auto;
}

/* Status Indicator */
.collaboration-status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    min-width: 200px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-indicator.online .status-dot {
    background: #43e97b;
}

.status-indicator.offline .status-dot {
    background: #fa709a;
}

.status-indicator.connecting .status-dot {
    background: #ffc107;
}

.status-indicator.error .status-dot {
    background: #dc3545;
}

.status-text {
    font-weight: 500;
    color: var(--text-primary);
}

.active-users-count {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.users-icon {
    font-size: 1rem;
}

/* Active Users Panel */
.active-users-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 300px;
    max-height: 400px;
    padding: 20px;
    border-radius: 16px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.panel-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.users-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.user-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: var(--premium-primary);
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.user-activity {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.user-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: absolute;
    top: 8px;
    right: 8px;
}

.user-item.online .user-status-dot {
    background: #43e97b;
}

.user-item.away .user-status-dot {
    background: #ffc107;
}

.user-item.offline .user-status-dot {
    background: #6c757d;
}

.collaboration-actions {
    display: flex;
    gap: 8px;
}

.collaboration-actions .btn-sm {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.8rem;
}

/* User Cursors */
#collaborationCursors {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
}

.user-cursor {
    position: absolute;
    pointer-events: none;
    z-index: 9999;
    transition: all 0.1s ease-out;
}

.cursor-pointer {
    width: 0;
    height: 0;
    border-left: 8px solid #667eea;
    border-right: 8px solid transparent;
    border-bottom: 12px solid #667eea;
    border-top: 8px solid transparent;
    transform: rotate(-45deg);
}

.cursor-label {
    position: absolute;
    top: 20px;
    left: 10px;
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Comments System */
.comments-system {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.comments-panel {
    width: 350px;
    max-height: 500px;
    border-radius: 16px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
}

.comments-panel .panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.comments-list {
    flex: 1;
    max-height: 300px;
    overflow-y: auto;
    padding: 16px 20px;
}

.comment-item {
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid var(--premium-primary);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comment-user {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.comment-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.comment-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 8px;
}

.comment-actions {
    display: flex;
    gap: 12px;
}

.comment-action {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.comment-action:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.comment-action.liked {
    color: var(--premium-primary);
}

.comment-input {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-input textarea {
    resize: vertical;
    min-height: 60px;
    max-height: 120px;
}

/* Collaboration Notifications */
.collaboration-notifications {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 300px;
}

.collaboration-notification {
    padding: 12px 16px;
    border-radius: 8px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.collaboration-notification.info {
    background: rgba(79, 172, 254, 0.1);
    border-color: rgba(79, 172, 254, 0.3);
}

.collaboration-notification.success {
    background: rgba(67, 233, 123, 0.1);
    border-color: rgba(67, 233, 123, 0.3);
}

.collaboration-notification.warning {
    background: rgba(255, 193, 7, 0.1);
    border-color: rgba(255, 193, 7, 0.3);
}

.collaboration-notification.error {
    background: rgba(250, 112, 154, 0.1);
    border-color: rgba(250, 112, 154, 0.3);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.notification-icon {
    font-size: 1rem;
}

.notification-message {
    color: var(--text-primary);
    font-weight: 500;
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Invite Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.3s ease;
}

.invite-section {
    margin-bottom: 20px;
}

.invite-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.permission-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.permission-item input[type="checkbox"] {
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .collaboration-status {
        top: 10px;
        right: 10px;
        min-width: 150px;
        padding: 8px 12px;
    }
    
    .active-users-panel {
        top: 60px;
        right: 10px;
        width: calc(100vw - 20px);
        max-width: 300px;
    }
    
    .comments-panel {
        width: calc(100vw - 20px);
        max-width: 350px;
        bottom: 10px;
        right: 10px;
    }
    
    .collaboration-notifications {
        top: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .user-cursor {
        display: none; /* Ocultar cursors em mobile */
    }
}

/* Dark Theme Adjustments */
[data-theme="dark"] .collaboration-status,
[data-theme="dark"] .active-users-panel,
[data-theme="dark"] .comments-panel {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .collaboration-notification {
    background: rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .user-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .comment-item {
    background: rgba(0, 0, 0, 0.2);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Accessibility */
.collaboration-container button:focus,
.collaboration-container input:focus,
.collaboration-container textarea:focus {
    outline: 2px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .collaboration-status,
    .active-users-panel,
    .comments-panel,
    .collaboration-notification {
        border-width: 2px;
    }
    
    .status-dot,
    .user-status-dot {
        border: 1px solid currentColor;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .collaboration-container *,
    .user-cursor {
        animation: none !important;
        transition: none !important;
    }
    
    .status-dot {
        animation: none;
    }
}
