/* ═══════════════════════════════════════════
   PRESENCIA - Cursores remotos
   ═══════════════════════════════════════════ */

#presencia-cursors-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99999;
    overflow: hidden;
}

.presencia-cursor {
    position: absolute;
    top: 0;
    left: 0;
    will-change: transform;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 99999;
}

.presencia-cursor-hidden {
    opacity: 0;
}

.presencia-cursor-pointer {
    display: block;
    line-height: 0;
}

.presencia-cursor-pointer svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.presencia-cursor-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
    margin-top: -4px;
    padding: 2px 8px 2px 4px;
    border-radius: 10px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    pointer-events: none;
}

.presencia-cursor-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.presencia-cursor-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ═══════════════════════════════════════════
   PRESENCIA - Header avatars
   ═══════════════════════════════════════════ */

.presencia-header-avatars {
    display: flex;
    align-items: center;
    position: relative;
    margin-right: 4px;
    cursor: pointer;
}

.presencia-avatars-row {
    display: flex;
    align-items: center;
    gap: 0;
}

.presencia-avatar-item {
    position: relative;
    margin-left: -6px;
    transition: transform 0.15s ease;
}

.presencia-avatar-item:first-child {
    margin-left: 0;
}

.presencia-avatar-item:hover {
    transform: translateY(-2px);
    z-index: 2;
}

.presencia-avatar-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border: 2px solid var(--bg-primary, #fff);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    user-select: none;
}

.presencia-avatar-sm {
    width: 26px;
    height: 26px;
    font-size: 10px;
    border: none;
}

.presencia-avatar-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary, #fff);
}

.presencia-avatar-dot-panel {
    position: static;
    border: none;
    width: 8px;
    height: 8px;
    flex-shrink: 0;
}

.presencia-dot-online {
    background-color: #0ACF83;
}

.presencia-dot-away {
    background-color: #FFCD29;
}

.presencia-dot-offline {
    background-color: #B0B0B0;
}

.presencia-avatar-extra {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-tertiary, #e8e8e8);
    color: var(--text-secondary, #666);
    font-size: 10px;
    font-weight: 700;
    border: 2px solid var(--bg-primary, #fff);
}


/* ═══════════════════════════════════════════
   PRESENCIA - Panel desplegable
   ═══════════════════════════════════════════ */

.presencia-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    max-height: 380px;
    overflow-y: auto;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e2e2e2);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    display: none;
    animation: presencia-panel-in 0.15s ease;
    padding-bottom: 6px;
}

.presencia-panel-visible {
    display: block;
}

@keyframes presencia-panel-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.presencia-panel-header {
    padding: 14px 16px 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary, #888);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid var(--border-color, #f0f0f0);
    display: flex;
    align-items: center;
    gap: 8px;
}

.presencia-panel-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--bg-tertiary, #eee);
    color: var(--text-primary, #444);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.presencia-panel-group-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-tertiary, #aaa);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.presencia-panel-group-label .presencia-dot {
    width: 6px;
    height: 6px;
}

.presencia-panel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px;
    transition: background 0.1s;
}

.presencia-panel-item:hover {
    background: var(--bg-hover, #f7f7f7);
}

.presencia-panel-info {
    flex: 1;
    min-width: 0;
}

.presencia-panel-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #222);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.presencia-panel-meta {
    display: block;
    font-size: 11px;
    color: var(--text-tertiary, #aaa);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.presencia-panel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.presencia-panel-empty {
    padding: 24px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary, #999);
}


/* ═══════════════════════════════════════════
   PRESENCIA - Badges en tabla de usuarios
   ═══════════════════════════════════════════ */

.presencia-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.presencia-badge-online {
    background: rgba(10, 207, 131, 0.1);
    color: #059669;
}

.presencia-badge-away {
    background: rgba(255, 205, 41, 0.15);
    color: #b8860b;
}

.presencia-badge-offline {
    background: rgba(0, 0, 0, 0.05);
    color: #888;
}

.presencia-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════
   PRESENCIA - Ajustes section
   ═══════════════════════════════════════════ */

.presencia-ajustes-section {
    max-width: 560px;
    padding: 24px;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e8e8e8);
    border-radius: 12px;
    margin-top: 16px;
}

.presencia-ajustes-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--text-primary, #222);
}

.presencia-ajustes-desc {
    font-size: 13px;
    color: var(--text-secondary, #888);
    margin: 0 0 20px;
}

.presencia-ajustes-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.presencia-ajustes-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.presencia-ajustes-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #333);
}

.presencia-ajustes-field input[type="number"] {
    max-width: 160px;
}

.presencia-ajustes-toggle-wrap {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

/* Toggle switch */
.presencia-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.presencia-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.presencia-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    border-radius: 22px;
    transition: background-color 0.2s;
}

.presencia-toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.presencia-toggle input:checked + .presencia-toggle-slider {
    background-color: #0ACF83;
}

.presencia-toggle input:checked + .presencia-toggle-slider::before {
    transform: translateX(18px);
}


/* ═══════════════════════════════════════════
   PRESENCIA - Responsive
   ═══════════════════════════════════════════ */

@media (max-width: 768px) {
    .presencia-header-avatars {
        display: none;
    }

    .presencia-cursor {
        display: none;
    }

    .presencia-panel {
        width: 260px;
    }
}
